]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mfd: dln2: Drop redundant device reference
authorJohan Hovold <johan@kernel.org>
Thu, 5 Mar 2026 13:03:58 +0000 (14:03 +0100)
committerLee Jones <lee@kernel.org>
Wed, 25 Mar 2026 12:44:54 +0000 (12:44 +0000)
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/20260305130358.24681-1-johan@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/dln2.c

index d12510e391c81a821c0dc03c8a5786ed099a1a0b..c810b83ac955dad47080e8b428b3794d73eae5f4 100644 (file)
@@ -600,7 +600,6 @@ static void dln2_stop_rx_urbs(struct dln2_dev *dln2)
 static void dln2_free(struct dln2_dev *dln2)
 {
        dln2_free_rx_urbs(dln2);
-       usb_put_dev(dln2->usb_dev);
        kfree(dln2);
 }
 
@@ -784,7 +783,7 @@ static int dln2_probe(struct usb_interface *interface,
 
        dln2->ep_out = epout->bEndpointAddress;
        dln2->ep_in = epin->bEndpointAddress;
-       dln2->usb_dev = usb_get_dev(interface_to_usbdev(interface));
+       dln2->usb_dev = interface_to_usbdev(interface);
        dln2->interface = interface;
        usb_set_intfdata(interface, dln2);
        init_waitqueue_head(&dln2->disconnect_wq);