Skip to contentSkip to conversation

ieee802154: atusb: drop redundant device reference

PATCH Applied Johan Hovold 5 participants 6 messages Mar 5 – Mar 24

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ieee802154: atusb: drop redundant device reference

Driver core holds a reference to the USB interface and its parent USB device while the interface is bound to a driver and there is no need to take additional references unless the structures are needed after disconnect.

Drop the redundant device reference to reduce cargo culting, make it easier to spot drivers where an extra reference is needed, and reduce the risk of memory leaks when drivers fail to release it.

---
 drivers/net/ieee802154/atusb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ieee802154/atusb.c +1 -4
index 95a4a3cdc8a4..5f7fc4ee7a07 100644
@@ -961,7 +961,7 @@ static int atusb_probe(struct usb_interface *interface,
 
 	atusb = hw->priv;
 	atusb->hw = hw;
-	atusb->usb_dev = usb_get_dev(usb_dev);
+	atusb->usb_dev = usb_dev;
 	usb_set_intfdata(interface, atusb);
 
 	atusb->shutdown = 0;
@@ -1055,7 +1055,6 @@ static int atusb_probe(struct usb_interface *interface,
 	atusb_free_urbs(atusb);
 	usb_kill_urb(atusb->tx_urb);
 	usb_free_urb(atusb->tx_urb);
-	usb_put_dev(usb_dev);
 	ieee802154_free_hw(hw);
 	return ret;
 }
@@ -1076,8 +1075,6 @@ static void atusb_disconnect(struct usb_interface *interface)
 
 	ieee802154_unregister_hw(atusb->hw);
 
-	usb_put_dev(atusb->usb_dev);
-
 	ieee802154_free_hw(atusb->hw);
 
 	usb_set_intfdata(interface, NULL);
Signature · 1 line
2.52.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Johan Hovold

Driver core holds a reference to the USB interface and its parent USB device while the interface is bound to a driver and there is no need to take additional references unless the structures are needed after disconnect.

Drop the redundant device reference to reduce cargo culting, make it easier to spot drivers where an extra reference is needed, and reduce the risk of memory leaks when drivers fail to release it.

I'm not qualified enough to judge how useful that can be, but on the other hand I don't believe it will hurt either, so:

Thanks,
Miquèl

maintainer Acked-by
#3 lore raw
In reply to Stefan Schmidt

Hello again,

Quoted 39 lines · Stefan Schmidt

Hello,

Quoted 36 lines · Johan Hovold

Driver core holds a reference to the USB interface and its parent USB device while the interface is bound to a driver and there is no need to take additional references unless the structures are needed after disconnect.

Drop the redundant device reference to reduce cargo culting, make it easier to spot drivers where an extra reference is needed, and reduce the risk of memory leaks when drivers fail to release it.

---
  drivers/net/ieee802154/atusb.c | 5 +----

  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ieee802154/atusb.c +1 -2
index 95a4a3cdc8a4..5f7fc4ee7a07 100644
@@ -961,7 +961,7 @@ static int atusb_probe(struct usb_interface 
 *interface,
       atusb = hw->priv;
       atusb->hw = hw;
-    atusb->usb_dev = usb_get_dev(usb_dev);
+    atusb->usb_dev = usb_dev;
       usb_set_intfdata(interface, atusb);
       atusb->shutdown = 0;
@@ -1055,7 +1055,6 @@ static int atusb_probe(struct usb_interface 
 *interface,
       atusb_free_urbs(atusb);
       usb_kill_urb(atusb->tx_urb);
       usb_free_urb(atusb->tx_urb);
-    usb_put_dev(usb_dev);
       ieee802154_free_hw(hw);
       return ret;

  }

drivers/net/ieee802154/atusb.c +0 -0
@@ -1076,8 +1075,6 @@ static void atusb_disconnect(struct 
Quoted 8 lines

drivers/net/ieee802154/atusb.c static void atusb_disconnect(struct usb_interface *interface) · line 1080

Quoted 6 lines
drivers/net/ieee802154/atusb.c +0 -2
 usb_interface *interface)
       ieee802154_unregister_hw(atusb->hw);
-    usb_put_dev(atusb->usb_dev);
-
       ieee802154_free_hw(atusb->hw);
       usb_set_intfdata(interface, NULL);

Given that this does not actually go through my tree an Acked-by would be more appropriate here. Sorry, its late.

Quoted 2 lines

Jakub, Dave or Paolo can you folks please pick this up into net-next? I waited a moment but I have nothing else for wpan-next in the queue for now, so it would be silly to have a pull-request just for this.

regards
Stefan Schmidt

maintainer
#2 lore raw
In reply to Johan Hovold

Hello,

Quoted 36 lines · Johan Hovold

Driver core holds a reference to the USB interface and its parent USB device while the interface is bound to a driver and there is no need to take additional references unless the structures are needed after disconnect.

Drop the redundant device reference to reduce cargo culting, make it easier to spot drivers where an extra reference is needed, and reduce the risk of memory leaks when drivers fail to release it.

---
  drivers/net/ieee802154/atusb.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ieee802154/atusb.c +1 -2
index 95a4a3cdc8a4..5f7fc4ee7a07 100644
@@ -961,7 +961,7 @@ static int atusb_probe(struct usb_interface *interface,
 
  	atusb = hw->priv;
  	atusb->hw = hw;
-	atusb->usb_dev = usb_get_dev(usb_dev);
+	atusb->usb_dev = usb_dev;
  	usb_set_intfdata(interface, atusb);
 
  	atusb->shutdown = 0;
@@ -1055,7 +1055,6 @@ static int atusb_probe(struct usb_interface *interface,
  	atusb_free_urbs(atusb);
  	usb_kill_urb(atusb->tx_urb);
  	usb_free_urb(atusb->tx_urb);
-	usb_put_dev(usb_dev);
  	ieee802154_free_hw(hw);
  	return ret;
  }

drivers/net/ieee802154/atusb.c static void atusb_disconnect(struct usb_interface *interface) · line 1080

Quoted 8 lines
drivers/net/ieee802154/atusb.c +0 -2
@@ -1076,8 +1075,6 @@ static void atusb_disconnect(struct usb_interface *interface)
 
  	ieee802154_unregister_hw(atusb->hw);
 
-	usb_put_dev(atusb->usb_dev);
-
  	ieee802154_free_hw(atusb->hw);
 
  	usb_set_intfdata(interface, NULL);

Jakub, Dave or Paolo can you folks please pick this up into net-next? I waited a moment but I have nothing else for wpan-next in the queue for now, so it would be silly to have a pull-request just for this.

regards
Stefan Schmidt

maintainer
#4 lore raw
In reply to Stefan Schmidt
Quoted 8 lines · On Sun, 22 Mar 2026 23:30:58 +0100 Stefan Schmidt wrote:

Given that this does not actually go through my tree an Acked-by would be more appropriate here. Sorry, its late.

Quoted 3 lines

Jakub, Dave or Paolo can you folks please pick this up into net-next? I waited a moment but I have nothing else for wpan-next in the queue for now, so it would be silly to have a pull-request just for this.

Will do, thanks!

#5 lore raw
In reply to Johan Hovold
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Thu, 5 Mar 2026 11:43:13 +0100 you wrote:

Driver core holds a reference to the USB interface and its parent USB device while the interface is bound to a driver and there is no need to take additional references unless the structures are needed after disconnect.

Drop the redundant device reference to reduce cargo culting, make it easier to spot drivers where an extra reference is needed, and reduce the risk of memory leaks when drivers fail to release it.

[...]

Here is the summary with links:
- ieee802154: atusb: drop redundant device reference

    https://git.kernel.org/netdev/net-next/c/4e9b1994a105

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html