]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
USB: trancevibrator: drop redundant device reference
authorJohan Hovold <johan@kernel.org>
Thu, 5 Mar 2026 11:15:10 +0000 (12:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Mar 2026 14:14:35 +0000 (15:14 +0100)
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-5-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/misc/trancevibrator.c

index 6aaec2db360b9b165de0e6f48daa866d0ab25f84..37f6b79889a64e0a51504d8b9e05a1dd3414024a 100644 (file)
@@ -92,7 +92,7 @@ static int tv_probe(struct usb_interface *interface,
                goto error;
        }
 
-       dev->udev = usb_get_dev(udev);
+       dev->udev = udev;
        usb_set_intfdata(interface, dev);
 
        return 0;
@@ -108,7 +108,6 @@ static void tv_disconnect(struct usb_interface *interface)
 
        dev = usb_get_intfdata (interface);
        usb_set_intfdata(interface, NULL);
-       usb_put_dev(dev->udev);
        kfree(dev);
 }