From: Johan Hovold <johan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Lixu Zhang <lixu.zhang@intel.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Johan Hovold <johan@kernel.org>
Subject: [PATCH 2/5] USB: cytherm: drop redundant device reference
Date: Thu, 5 Mar 2026 12:15:08 +0100 [thread overview]
Message-ID: <20260305111511.18386-3-johan@kernel.org> (raw)
In-Reply-To: <20260305111511.18386-1-johan@kernel.org>
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/usb/misc/cytherm.c | 4 +---
1 file changed, 1 insertion(+), 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");
--
2.52.0
next prev parent reply other threads:[~2026-03-05 11:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 11:15 [PATCH 0/5] USB: drop redundant references Johan Hovold
2026-03-05 11:15 ` [PATCH 1/5] USB: cypress_cy7c63: drop redundant device reference Johan Hovold
2026-03-05 11:15 ` Johan Hovold [this message]
2026-03-05 11:15 ` [PATCH 3/5] USB: ljca: drop redundant interface reference Johan Hovold
2026-03-05 13:18 ` Sakari Ailus
2026-03-05 11:15 ` [PATCH 4/5] USB: trancevibrator: drop redundant device reference Johan Hovold
2026-03-05 11:15 ` [PATCH 5/5] USB: usbsevseg: " Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260305111511.18386-3-johan@kernel.org \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lixu.zhang@intel.com \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox