]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: drop redundant device reference
authorJohan Hovold <johan@kernel.org>
Fri, 6 Mar 2026 09:32:06 +0000 (10:32 +0100)
committerPing-Ke Shih <pkshih@realtek.com>
Mon, 16 Mar 2026 06:03:39 +0000 (14:03 +0800)
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>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260306093206.21081-1-johan@kernel.org
drivers/net/wireless/realtek/rtw89/usb.c

index da1b7ce8089e219fcac1b4ad7e265566bca1c780..64f0c0ec5ed4d97b585b455b5cbc0ee9d77e4000 100644 (file)
@@ -935,7 +935,7 @@ static int rtw89_usb_intf_init(struct rtw89_dev *rtwdev,
        if (!rtwusb->vendor_req_buf)
                return -ENOMEM;
 
-       rtwusb->udev = usb_get_dev(interface_to_usbdev(intf));
+       rtwusb->udev = interface_to_usbdev(intf);
 
        usb_set_intfdata(intf, rtwdev->hw);
 
@@ -949,7 +949,6 @@ static void rtw89_usb_intf_deinit(struct rtw89_dev *rtwdev,
 {
        struct rtw89_usb *rtwusb = rtw89_usb_priv(rtwdev);
 
-       usb_put_dev(rtwusb->udev);
        kfree(rtwusb->vendor_req_buf);
        usb_set_intfdata(intf, NULL);
 }