* [PATCH] mfd: dln2: drop redundant device reference
@ 2026-03-05 13:03 Johan Hovold
2026-03-06 11:33 ` (subset) " Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2026-03-05 13:03 UTC (permalink / raw)
To: Lee Jones; +Cc: linux-kernel, 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 <johan@kernel.org>
---
drivers/mfd/dln2.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
index d12510e391c8..c810b83ac955 100644
--- a/drivers/mfd/dln2.c
+++ b/drivers/mfd/dln2.c
@@ -600,7 +600,6 @@ static void dln2_stop_rx_urbs(struct dln2_dev *dln2)
static void dln2_free(struct dln2_dev *dln2)
{
dln2_free_rx_urbs(dln2);
- usb_put_dev(dln2->usb_dev);
kfree(dln2);
}
@@ -784,7 +783,7 @@ static int dln2_probe(struct usb_interface *interface,
dln2->ep_out = epout->bEndpointAddress;
dln2->ep_in = epin->bEndpointAddress;
- dln2->usb_dev = usb_get_dev(interface_to_usbdev(interface));
+ dln2->usb_dev = interface_to_usbdev(interface);
dln2->interface = interface;
usb_set_intfdata(interface, dln2);
init_waitqueue_head(&dln2->disconnect_wq);
--
2.52.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: (subset) [PATCH] mfd: dln2: drop redundant device reference
2026-03-05 13:03 [PATCH] mfd: dln2: drop redundant device reference Johan Hovold
@ 2026-03-06 11:33 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2026-03-06 11:33 UTC (permalink / raw)
To: Lee Jones, Johan Hovold; +Cc: linux-kernel
On Thu, 05 Mar 2026 14:03:58 +0100, 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.
>
> [...]
Applied, thanks!
[1/1] mfd: dln2: drop redundant device reference
commit: 70ef533c72f8b353ed07e3f566ac381684023992
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-06 11:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-05 13:03 [PATCH] mfd: dln2: drop redundant device reference Johan Hovold
2026-03-06 11:33 ` (subset) " Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox