summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2026-03-05 14:15:08 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-03-11 17:14:35 +0300
commitbb49af3c56a60af57abdd5e6c753da87d30306fe (patch)
tree9a17594cbaeaea053e5606d36bf56c8befcc97e0
parent70cd7459ea42ac4ee059ee9522e23f6028dfd1bd (diff)
downloadlinux-bb49af3c56a60af57abdd5e6c753da87d30306fe.tar.xz
USB: cytherm: 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 <johan@kernel.org> Link: https://patch.msgid.link/20260305111511.18386-3-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/misc/cytherm.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c
index 2bf082474e9d..b183df9826bc 100644
--- a/drivers/usb/misc/cytherm.c
+++ b/drivers/usb/misc/cytherm.c
@@ -311,7 +311,7 @@ static int cytherm_probe(struct usb_interface *interface,
if (!dev)
goto error_mem;
- dev->udev = usb_get_dev(udev);
+ dev->udev = udev;
usb_set_intfdata(interface, dev);
@@ -334,8 +334,6 @@ static void cytherm_disconnect(struct usb_interface *interface)
/* first remove the files, then NULL the pointer */
usb_set_intfdata(interface, NULL);
- usb_put_dev(dev->udev);
-
kfree(dev);
dev_info(&interface->dev, "Cypress thermometer now disconnected\n");