mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 02:53:36 +02:00
wifi: rtl8xxxu: 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> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20260306085144.12064-18-johan@kernel.org
This commit is contained in:
parent
68e7d359a5
commit
711b8add39
|
|
@ -7686,7 +7686,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
|
|||
int ret;
|
||||
int untested = 1;
|
||||
|
||||
udev = usb_get_dev(interface_to_usbdev(interface));
|
||||
udev = interface_to_usbdev(interface);
|
||||
|
||||
switch (id->idVendor) {
|
||||
case USB_VENDOR_ID_REALTEK:
|
||||
|
|
@ -7745,10 +7745,8 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
|
|||
}
|
||||
|
||||
hw = ieee80211_alloc_hw(sizeof(struct rtl8xxxu_priv), &rtl8xxxu_ops);
|
||||
if (!hw) {
|
||||
ret = -ENOMEM;
|
||||
goto err_put_dev;
|
||||
}
|
||||
if (!hw)
|
||||
return -ENOMEM;
|
||||
|
||||
priv = hw->priv;
|
||||
priv->hw = hw;
|
||||
|
|
@ -7890,8 +7888,6 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
|
|||
mutex_destroy(&priv->h2c_mutex);
|
||||
|
||||
ieee80211_free_hw(hw);
|
||||
err_put_dev:
|
||||
usb_put_dev(udev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -7924,7 +7920,6 @@ static void rtl8xxxu_disconnect(struct usb_interface *interface)
|
|||
"Device still attached, trying to reset\n");
|
||||
usb_reset_device(priv->udev);
|
||||
}
|
||||
usb_put_dev(priv->udev);
|
||||
ieee80211_free_hw(hw);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user