]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: ath10k: drop redundant device reference
authorJohan Hovold <johan@kernel.org>
Fri, 6 Mar 2026 08:51:30 +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-5-johan@kernel.org
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath10k/usb.c

index 6661fff326e086c6b0cbb08de975129f57731dbd..ad1cf0681b19044b0e489b994869c88576f11ecc 100644 (file)
@@ -1016,7 +1016,6 @@ static int ath10k_usb_probe(struct usb_interface *interface,
 
        netif_napi_add(ar->napi_dev, &ar->napi, ath10k_usb_napi_poll);
 
-       usb_get_dev(dev);
        vendor_id = le16_to_cpu(dev->descriptor.idVendor);
        product_id = le16_to_cpu(dev->descriptor.idProduct);
 
@@ -1055,8 +1054,6 @@ err_usb_destroy:
 err:
        ath10k_core_destroy(ar);
 
-       usb_put_dev(dev);
-
        return ret;
 }
 
@@ -1071,7 +1068,6 @@ static void ath10k_usb_remove(struct usb_interface *interface)
        ath10k_core_unregister(ar_usb->ar);
        netif_napi_del(&ar_usb->ar->napi);
        ath10k_usb_destroy(ar_usb->ar);
-       usb_put_dev(interface_to_usbdev(interface));
        ath10k_core_destroy(ar_usb->ar);
 }