Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Johan Hovold and committed by
Johannes Berg
c882b7a6 4e0417a0

+4 -8
+4 -8
drivers/net/wireless/atmel/at76c50x-usb.c
··· 2440 2440 struct mib_fw_version *fwv; 2441 2441 int board_type = (int)id->driver_info; 2442 2442 2443 - udev = usb_get_dev(interface_to_usbdev(interface)); 2443 + udev = interface_to_usbdev(interface); 2444 2444 2445 2445 fwv = kmalloc_obj(*fwv); 2446 - if (!fwv) { 2447 - ret = -ENOMEM; 2448 - goto exit; 2449 - } 2446 + if (!fwv) 2447 + return -ENOMEM; 2450 2448 2451 2449 /* Load firmware into kernel memory */ 2452 2450 fwe = at76_load_firmware(udev, board_type); ··· 2532 2534 2533 2535 exit: 2534 2536 kfree(fwv); 2535 - if (ret < 0) 2536 - usb_put_dev(udev); 2537 + 2537 2538 return ret; 2538 2539 } 2539 2540 ··· 2549 2552 2550 2553 wiphy_info(priv->hw->wiphy, "disconnecting\n"); 2551 2554 at76_delete_device(priv); 2552 - usb_put_dev(interface_to_usbdev(interface)); 2553 2555 dev_info(&interface->dev, "disconnected\n"); 2554 2556 } 2555 2557