Search Linux Wireless

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

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

 



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.

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)
 			platform_driver_unregister(&brcmf_pd);
 	}
 
-- 
2.49.0





[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