From: Johan Hovold Date: Thu, 5 Mar 2026 11:10:18 +0000 (+0100) Subject: nfc: pn533: drop redundant device reference X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c7f710325228a54a364ae433acd8779c2fc2bcf;p=thirdparty%2Flinux.git nfc: pn533: 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-2-johan@kernel.org Signed-off-by: Jakub Kicinski --- diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c index 0f12f86ebb023..0ff2f0d7caf4d 100644 --- a/drivers/nfc/pn533/usb.c +++ b/drivers/nfc/pn533/usb.c @@ -500,7 +500,7 @@ static int pn533_usb_probe(struct usb_interface *interface, if (!in_buf) return -ENOMEM; - phy->udev = usb_get_dev(interface_to_usbdev(interface)); + phy->udev = interface_to_usbdev(interface); phy->interface = interface; iface_desc = interface->cur_altsetting; @@ -600,7 +600,6 @@ error: usb_free_urb(phy->in_urb); usb_free_urb(phy->out_urb); usb_free_urb(phy->ack_urb); - usb_put_dev(phy->udev); kfree(in_buf); kfree(phy->ack_buffer); @@ -628,7 +627,6 @@ static void pn533_usb_disconnect(struct usb_interface *interface) usb_free_urb(phy->out_urb); usb_free_urb(phy->ack_urb); kfree(phy->ack_buffer); - usb_put_dev(phy->udev); nfc_info(&interface->dev, "NXP PN533 NFC device disconnected\n"); }