]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: ath6kl: drop redundant device reference
authorJohan Hovold <johan@kernel.org>
Fri, 6 Mar 2026 08:51:27 +0000 (09:51 +0100)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Tue, 10 Mar 2026 15:27:55 +0000 (08:27 -0700)
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/20260306085144.12064-2-johan@kernel.org
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath6kl/usb.c

index 852e77e41bde57f4c9ed3884e4fca05cecb68a20..814faf96f1ff41369ad2c2bcc5391538af055f75 100644 (file)
@@ -1124,8 +1124,6 @@ static int ath6kl_usb_probe(struct usb_interface *interface,
        int vendor_id, product_id;
        int ret = 0;
 
-       usb_get_dev(dev);
-
        vendor_id = le16_to_cpu(dev->descriptor.idVendor);
        product_id = le16_to_cpu(dev->descriptor.idProduct);
 
@@ -1143,11 +1141,8 @@ static int ath6kl_usb_probe(struct usb_interface *interface,
                ath6kl_dbg(ATH6KL_DBG_USB, "USB 1.1 Host\n");
 
        ar_usb = ath6kl_usb_create(interface);
-
-       if (ar_usb == NULL) {
-               ret = -ENOMEM;
-               goto err_usb_put;
-       }
+       if (ar_usb == NULL)
+               return -ENOMEM;
 
        ar = ath6kl_core_create(&ar_usb->udev->dev);
        if (ar == NULL) {
@@ -1176,15 +1171,12 @@ err_core_free:
        ath6kl_core_destroy(ar);
 err_usb_destroy:
        ath6kl_usb_destroy(ar_usb);
-err_usb_put:
-       usb_put_dev(dev);
 
        return ret;
 }
 
 static void ath6kl_usb_remove(struct usb_interface *interface)
 {
-       usb_put_dev(interface_to_usbdev(interface));
        ath6kl_usb_device_detached(interface);
 }