]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mt76x0u: drop redundant device reference
authorJohan Hovold <johan@kernel.org>
Thu, 30 Apr 2026 08:33:32 +0000 (10:33 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 9 Jun 2026 10:15:20 +0000 (10:15 +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/20260430083335.215239-3-johan@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76x0/usb.c

index 90e5666c0857dc64a72b005d0cfcb7717f45230a..2acce121fb1473a2bfbc8e6faf33824c7ab1c445 100644 (file)
@@ -245,7 +245,6 @@ static int mt76x0u_probe(struct usb_interface *usb_intf,
        if (id->driver_info)
                dev->no_2ghz = true;
 
-       usb_dev = usb_get_dev(usb_dev);
        usb_reset_device(usb_dev);
 
        usb_set_intfdata(usb_intf, dev);
@@ -284,7 +283,6 @@ static int mt76x0u_probe(struct usb_interface *usb_intf,
 
 err:
        usb_set_intfdata(usb_intf, NULL);
-       usb_put_dev(interface_to_usbdev(usb_intf));
        mt76u_queues_deinit(&dev->mt76);
        mt76_free_device(&dev->mt76);
 
@@ -303,7 +301,6 @@ static void mt76x0_disconnect(struct usb_interface *usb_intf)
        mt76x0u_cleanup(dev);
 
        usb_set_intfdata(usb_intf, NULL);
-       usb_put_dev(interface_to_usbdev(usb_intf));
 
        mt76_free_device(&dev->mt76);
 }