On Thu Mar 5 11:39:17 2026 +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.
>
> Signed-off-by: Johan Hovold <[email protected]>
> Signed-off-by: Sean Young <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>
Patch committed.
Thanks,
Hans Verkuil
drivers/media/rc/mceusb.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 06222eee1754..6a9e4382a224 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -1729,7 +1729,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
goto urb_in_alloc_fail;
ir->usbintf = intf;
- ir->usbdev = usb_get_dev(dev);
+ ir->usbdev = dev;
ir->dev = &intf->dev;
ir->len_in = maxp;
ir->flags.microsoft_gen1 = is_microsoft_gen1;
@@ -1817,7 +1817,6 @@ static int mceusb_dev_probe(struct usb_interface *intf,
/* Error-handling path */
rc_dev_fail:
cancel_work_sync(&ir->kevent);
- usb_put_dev(ir->usbdev);
usb_kill_urb(ir->urb_in);
usb_free_urb(ir->urb_in);
urb_in_alloc_fail:
@@ -1849,7 +1848,6 @@ static void mceusb_dev_disconnect(struct usb_interface
*intf)
usb_kill_urb(ir->urb_in);
usb_free_urb(ir->urb_in);
usb_free_coherent(dev, ir->len_in, ir->buf_in, ir->dma_in);
- usb_put_dev(dev);
rc_free_device(ir->rc);
kfree(ir);
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]