drivers/i2c/busses/i2c-robotfuzz-osif.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
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/i2c/busses/i2c-robotfuzz-osif.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-robotfuzz-osif.c b/drivers/i2c/busses/i2c-robotfuzz-osif.c
index e0a76fb5bc31..412fa8e37f69 100644
--- a/drivers/i2c/busses/i2c-robotfuzz-osif.c
+++ b/drivers/i2c/busses/i2c-robotfuzz-osif.c
@@ -141,7 +141,7 @@ static int osif_probe(struct usb_interface *interface,
if (!priv)
return -ENOMEM;
- priv->usb_dev = usb_get_dev(interface_to_usbdev(interface));
+ priv->usb_dev = interface_to_usbdev(interface);
priv->interface = interface;
usb_set_intfdata(interface, priv);
@@ -163,7 +163,6 @@ static int osif_probe(struct usb_interface *interface,
NULL, 0);
if (ret) {
dev_err(&interface->dev, "failure sending bit rate");
- usb_put_dev(priv->usb_dev);
return ret;
}
@@ -184,7 +183,6 @@ static void osif_disconnect(struct usb_interface *interface)
i2c_del_adapter(&(priv->adapter));
usb_set_intfdata(interface, NULL);
- usb_put_dev(priv->usb_dev);
}
static struct usb_driver osif_driver = {
--
2.52.0
On Thu, Mar 05, 2026 at 11:29:55AM +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 <johan@kernel.org> Applied to for-next, thanks!
© 2016 - 2026 Red Hat, Inc.