mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 04:21:09 -04:00
USB: usbsevseg: 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/20260305111511.18386-6-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
58221c728d
commit
9b91cafe80
@@ -312,7 +312,7 @@ static int sevseg_probe(struct usb_interface *interface,
|
||||
if (!mydev)
|
||||
goto error_mem;
|
||||
|
||||
mydev->udev = usb_get_dev(udev);
|
||||
mydev->udev = udev;
|
||||
mydev->intf = interface;
|
||||
usb_set_intfdata(interface, mydev);
|
||||
|
||||
@@ -338,7 +338,6 @@ static void sevseg_disconnect(struct usb_interface *interface)
|
||||
|
||||
mydev = usb_get_intfdata(interface);
|
||||
usb_set_intfdata(interface, NULL);
|
||||
usb_put_dev(mydev->udev);
|
||||
kfree(mydev);
|
||||
dev_info(&interface->dev, "USB 7 Segment now disconnected\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user