Skip to content

Commit c2b06b1

Browse files
jhovoldlag-linaro
authored andcommitted
mfd: dln2: 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/20260305130358.24681-1-johan@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
1 parent f385ec3 commit c2b06b1

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/mfd/dln2.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,6 @@ static void dln2_stop_rx_urbs(struct dln2_dev *dln2)
600600
static void dln2_free(struct dln2_dev *dln2)
601601
{
602602
dln2_free_rx_urbs(dln2);
603-
usb_put_dev(dln2->usb_dev);
604603
kfree(dln2);
605604
}
606605

@@ -784,7 +783,7 @@ static int dln2_probe(struct usb_interface *interface,
784783

785784
dln2->ep_out = epout->bEndpointAddress;
786785
dln2->ep_in = epin->bEndpointAddress;
787-
dln2->usb_dev = usb_get_dev(interface_to_usbdev(interface));
786+
dln2->usb_dev = interface_to_usbdev(interface);
788787
dln2->interface = interface;
789788
usb_set_intfdata(interface, dln2);
790789
init_waitqueue_head(&dln2->disconnect_wq);

0 commit comments

Comments
 (0)