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.

i2c: robotfuzz-osif: 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: Wolfram Sang <wsa+renesas@sang-engineering.com>

authored by

Johan Hovold and committed by
Wolfram Sang
7bc4c8f3 1f318b96

+1 -3
+1 -3
drivers/i2c/busses/i2c-robotfuzz-osif.c
··· 141 141 if (!priv) 142 142 return -ENOMEM; 143 143 144 - priv->usb_dev = usb_get_dev(interface_to_usbdev(interface)); 144 + priv->usb_dev = interface_to_usbdev(interface); 145 145 priv->interface = interface; 146 146 147 147 usb_set_intfdata(interface, priv); ··· 163 163 NULL, 0); 164 164 if (ret) { 165 165 dev_err(&interface->dev, "failure sending bit rate"); 166 - usb_put_dev(priv->usb_dev); 167 166 return ret; 168 167 } 169 168 ··· 183 184 184 185 i2c_del_adapter(&(priv->adapter)); 185 186 usb_set_intfdata(interface, NULL); 186 - usb_put_dev(priv->usb_dev); 187 187 } 188 188 189 189 static struct usb_driver osif_driver = {