mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-05-05 09:57:21 +02:00
USB: cypress_cy7c63: 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-2-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3222f3ed0b
commit
70cd7459ea
@@ -215,7 +215,7 @@ static int cypress_probe(struct usb_interface *interface,
|
||||
if (!dev)
|
||||
goto error_mem;
|
||||
|
||||
dev->udev = usb_get_dev(interface_to_usbdev(interface));
|
||||
dev->udev = interface_to_usbdev(interface);
|
||||
|
||||
/* save our data pointer in this interface device */
|
||||
usb_set_intfdata(interface, dev);
|
||||
@@ -239,8 +239,6 @@ static void cypress_disconnect(struct usb_interface *interface)
|
||||
* device files have been removed */
|
||||
usb_set_intfdata(interface, NULL);
|
||||
|
||||
usb_put_dev(dev->udev);
|
||||
|
||||
dev_info(&interface->dev,
|
||||
"Cypress CY7C63xxx device now disconnected\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user