Skip to contentSkip to conversation

bcma: use (get|put)_device when probing/removing device driver

PATCH In review Rafał Miłecki 2 participants 3 messages Jan 28, 2017 – Jan 31, 2017 Broadcom specific amba driver (bcma)

lore
Share & tools
lore

Rafał Miłecki

author maintainer
#0 lore raw

PATCH 1/1 bcma: use (get|put)_device when probing/removing device driver

From: Rafał Miłecki <[email protected]>

This allows tracking device state and e.g. makes devm work as expected.

---
Kalle: this issue is in bcma since /ever/, so I'm Cc-ing stable without pointing any version.

If someone reviewes (you or anyone) you may consider taking it as 3.10 fix. Can someone confirm this patch is OK?

---
 drivers/bcma/main.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/bcma/main.c +4 -0
index 2c1798e38abd..38688236b3cd 100644
@@ -633,8 +633,11 @@ static int bcma_device_probe(struct device *dev)
 					       drv);
 	int err = 0;
 
+	get_device(dev);
 	if (adrv->probe)
 		err = adrv->probe(core);
+	if (err)
+		put_device(dev);
 
 	return err;
 }
@@ -647,6 +650,7 @@ static int bcma_device_remove(struct device *dev)
 
 	if (adrv->remove)
 		adrv->remove(core);
+	put_device(dev);
 
 	return 0;
 }
Signature · 1 line
2.11.0
#1 lore raw
Quoted 6 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

This allows tracking device state and e.g. makes devm work as expected.

At this stage of the cycle I think 4.11 is more approriate for this fix.

Signature · 6 lines
https://patchwork.kernel.org/patch/9543283/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#2 lore raw
In reply to Rafał Miłecki
Quoted 6 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

This allows tracking device state and e.g. makes devm work as expected.

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

a971df0b9d04 bcma: use (get|put)_device when probing/removing device driver

Signature · 6 lines
https://patchwork.kernel.org/patch/9543283/

Documentation about submitting wireless patches and checking status
from patchwork:

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