From: Johan Hovold Date: Thu, 5 Mar 2026 11:10:19 +0000 (+0100) Subject: nfc: port100: drop redundant device reference X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1a2d4bfa04919c2e1676b756ccc21dd8e22d3838;p=thirdparty%2Flinux.git nfc: port100: 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. Signed-off-by: Johan Hovold Link: https://patch.msgid.link/20260305111019.18030-3-johan@kernel.org Signed-off-by: Jakub Kicinski --- diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c index a922569d7b48..09dcc6f4c4f3 100644 --- a/drivers/nfc/port100.c +++ b/drivers/nfc/port100.c @@ -1504,7 +1504,7 @@ static int port100_probe(struct usb_interface *interface, return -ENOMEM; mutex_init(&dev->out_urb_lock); - dev->udev = usb_get_dev(interface_to_usbdev(interface)); + dev->udev = interface_to_usbdev(interface); dev->interface = interface; usb_set_intfdata(interface, dev); @@ -1616,7 +1616,6 @@ error: usb_free_urb(dev->in_urb); usb_kill_urb(dev->out_urb); usb_free_urb(dev->out_urb); - usb_put_dev(dev->udev); return rc; } @@ -1636,7 +1635,6 @@ static void port100_disconnect(struct usb_interface *interface) usb_free_urb(dev->in_urb); usb_free_urb(dev->out_urb); - usb_put_dev(dev->udev); kfree(dev->cmd);