Search Linux Wireless

Re: [PATCH] wifi: brcmfmac: avoid calling platform_driver_unregister() more than once

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/14/2025 10:34 AM, Dmitry Antipov wrote:
Since 'platform_driver_probe()' may call to 'platform_driver_unregister()'
itself (and denote such a case with -ENODEV), this case should be catched
to avoid calling 'platform_driver_unregister()' for a driver which is not
actually registered. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

This is unnecessary. Will try and clarify below...

Signed-off-by: Dmitry Antipov <dmantipov@xxxxxxxxx>
---
  drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
index cfcf01eb0daa..d60ed50e8bde 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -602,11 +602,11 @@ static struct platform_driver brcmf_pd = {
static int __init brcmfmac_module_init(void)
  {
-	int err;
+	int err, probe;
/* Get the platform data (if available) for our devices */
-	err = platform_driver_probe(&brcmf_pd, brcmf_common_pd_probe);
-	if (err == -ENODEV)
+	probe = platform_driver_probe(&brcmf_pd, brcmf_common_pd_probe);
+	if (probe == -ENODEV)
  		brcmf_dbg(INFO, "No platform data available.\n");
/* Initialize global module paramaters */
@@ -615,7 +615,7 @@ static int __init brcmfmac_module_init(void)
  	/* Continue the initialization by registering the different busses */
  	err = brcmf_core_init();
  	if (err) {
-		if (brcmfmac_pdata)
+		if (probe != -ENODEV)

When the platform_driver_probe() fails it means that brcmfmac_pdata will be NULL so it provides the same info as the returned error. So the net result is the same and no platform_driver_unregister() will be called.

Regards,
Arend




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux