drivers/net/ieee802154/atusb.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
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 <johan@kernel.org>
---
drivers/net/ieee802154/atusb.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
index 95a4a3cdc8a4..5f7fc4ee7a07 100644
--- a/drivers/net/ieee802154/atusb.c
+++ b/drivers/net/ieee802154/atusb.c
@@ -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);
--
2.52.0
Hello, On 3/5/26 11:43, Johan Hovold 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. > > Signed-off-by: Johan Hovold <johan@kernel.org> > --- > drivers/net/ieee802154/atusb.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c > index 95a4a3cdc8a4..5f7fc4ee7a07 100644 > --- a/drivers/net/ieee802154/atusb.c > +++ b/drivers/net/ieee802154/atusb.c > @@ -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); Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org> 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, On 3/22/26 23:27, Stefan Schmidt wrote: > Hello, > > On 3/5/26 11:43, Johan Hovold 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. >> >> Signed-off-by: Johan Hovold <johan@kernel.org> >> --- >> drivers/net/ieee802154/atusb.c | 5 +---- >> 1 file changed, 1 insertion(+), 4 deletions(-) >> >> diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/ >> atusb.c >> index 95a4a3cdc8a4..5f7fc4ee7a07 100644 >> --- a/drivers/net/ieee802154/atusb.c >> +++ b/drivers/net/ieee802154/atusb.c >> @@ -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); > > Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org> 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 <stefan@datenfreihafen.org> > 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
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 <stefan@datenfreihafen.org> > > > 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!
On 05/03/2026 at 11:43:13 +01, Johan Hovold <johan@kernel.org> 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. > > Signed-off-by: Johan Hovold <johan@kernel.org> 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: Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Thanks, Miquèl
© 2016 - 2026 Red Hat, Inc.