mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
wifi: at76c50x: 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> Link: https://patch.msgid.link/20260306085144.12064-7-johan@kernel.org Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
4e0417a009
commit
c882b7a603
|
|
@ -2440,13 +2440,11 @@ static int at76_probe(struct usb_interface *interface,
|
|||
struct mib_fw_version *fwv;
|
||||
int board_type = (int)id->driver_info;
|
||||
|
||||
udev = usb_get_dev(interface_to_usbdev(interface));
|
||||
udev = interface_to_usbdev(interface);
|
||||
|
||||
fwv = kmalloc_obj(*fwv);
|
||||
if (!fwv) {
|
||||
ret = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
if (!fwv)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Load firmware into kernel memory */
|
||||
fwe = at76_load_firmware(udev, board_type);
|
||||
|
|
@ -2534,8 +2532,7 @@ static int at76_probe(struct usb_interface *interface,
|
|||
|
||||
exit:
|
||||
kfree(fwv);
|
||||
if (ret < 0)
|
||||
usb_put_dev(udev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -2552,7 +2549,6 @@ static void at76_disconnect(struct usb_interface *interface)
|
|||
|
||||
wiphy_info(priv->hw->wiphy, "disconnecting\n");
|
||||
at76_delete_device(priv);
|
||||
usb_put_dev(interface_to_usbdev(interface));
|
||||
dev_info(&interface->dev, "disconnected\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user