Skip to contentSkip to conversation

qtnfmac: Missing platform_device_unregister() on error in qtnf_core_mac_alloc()

PATCH In review Wang Hai 3 participants 3 messages Jul 30, 2020 – Aug 2, 2020

Subsystems (3)
lore
Share & tools
lore

Wang Hai

author
#0 lore raw

PATCH 1/1 qtnfmac: Missing platform_device_unregister() on error in qtnf_core_mac_alloc()

Add the missing platform_device_unregister() before return from qtnf_core_mac_alloc() in the error handling case.

Fixes 616f5701f4ab ("qtnfmac: assign each wiphy to its own virtual platform device")
---
 drivers/net/wireless/quantenna/qtnfmac/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/quantenna/qtnfmac/core.c +4 -1
index eea777f8acea..6aafff9d4231 100644
@@ -446,8 +446,11 @@ static struct qtnf_wmac *qtnf_core_mac_alloc(struct qtnf_bus *bus,
 	}
 
 	wiphy = qtnf_wiphy_allocate(bus, pdev);
-	if (!wiphy)
+	if (!wiphy) {
+		if (pdev)
+			platform_device_unregister(pdev);
 		return ERR_PTR(-ENOMEM);
+	}
 
 	mac = wiphy_priv(wiphy);
 
Signature · 1 line
2.17.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines

Add the missing platform_device_unregister() before return from qtnf_core_mac_alloc() in the error handling case.

Fixes 616f5701f4ab ("qtnfmac: assign each wiphy to its own virtual platform device")
---
 drivers/net/wireless/quantenna/qtnfmac/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/quantenna/qtnfmac/core.c +0 -0
index eea777f8acea..6aafff9d4231 100644
@@ -446,8 +446,11 @@ static struct qtnf_wmac *qtnf_core_mac_alloc(struct qtnf_bus *bus,
 	}

drivers/net/wireless/quantenna/qtnfmac/core.c static struct qtnf_wmac *qtnf_core_mac_alloc(struct qtnf_bus *bus, · line 455

Quoted 10 lines
drivers/net/wireless/quantenna/qtnfmac/core.c +4 -1
 
 	wiphy = qtnf_wiphy_allocate(bus, pdev);
-	if (!wiphy)
+	if (!wiphy) {
+		if (pdev)
+			platform_device_unregister(pdev);
 		return ERR_PTR(-ENOMEM);
+	}
 
 	mac = wiphy_priv(wiphy);

Thanks,
Sergey

#2 lore raw
In reply to Wang Hai
Quoted 7 lines · Wang Hai

Add the missing platform_device_unregister() before return from qtnf_core_mac_alloc() in the error handling case.

Fixes 616f5701f4ab ("qtnfmac: assign each wiphy to its own virtual platform device")

Patch applied to wireless-drivers-next.git, thanks.

141bc9abbbff qtnfmac: Missing platform_device_unregister() on error in qtnf_core_mac_alloc()

Signature · 3 lines
https://patchwork.kernel.org/patch/11692387/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches