ieee802154: atusb: drop redundant device reference
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
@@ -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
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.
Signed-off-by Johan Hovold <[email protected]>
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
Stefan Schmidt
maintainerHello,
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.
Signed-off-by Johan Hovold <[email protected]>--- drivers/net/ieee802154/atusb.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/net/ieee802154/atusb.c +1
-2@@ -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
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.
Signed-off-by Johan Hovold <[email protected]>---
drivers/net/ieee802154/atusb.c| 5 +----1 file changed, 1 insertion(+), 4 deletions(-)drivers/net/ieee802154/atusb.c +1
-2@@ -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
-2usb_interface *interface) ieee802154_unregister_hw(atusb->hw); - usb_put_dev(atusb->usb_dev); - ieee802154_free_hw(atusb->hw); usb_set_intfdata(interface, NULL);Signed-off-by Stefan Schmidt <[email protected]>
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
Jakub Kicinski
maintainerQuoted 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.
Acked-by Stefan Schmidt <[email protected]>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!
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