Skip to contentSkip to conversation

usb: stkwebcam: update the reference count of the usb device structure

PATCH In review Salah Triki 2 participants 2 messages Jul 24, 2021 – Jul 25, 2021 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: stkwebcam: update the reference count of the usb device structure

Use usb_get_dev() and usb_put_dev() in order to update the reference count of the usb device structure.

---
 drivers/media/usb/stkwebcam/stk-webcam.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/usb/stkwebcam/stk-webcam.c +2 -1
index a45d464427c4..3b14679829ed 100644
@@ -1309,7 +1309,7 @@ static int stk_camera_probe(struct usb_interface *interface,
 	init_waitqueue_head(&dev->wait_frame);
 	dev->first_init = 1; /* webcam LED management */
 
-	dev->udev = udev;
+	dev->udev = usb_get_dev(udev);
 	dev->interface = interface;
 	usb_get_intf(interface);
 
@@ -1376,6 +1376,7 @@ static void stk_camera_disconnect(struct usb_interface *interface)
 
 	usb_set_intfdata(interface, NULL);
 	unset_present(dev);
+	usb_put_dev(interface_to_usbdev(interface));
 
 	wake_up_interruptible(&dev->wait_frame);
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 2 lines · Salah Triki

Use usb_get_dev() and usb_put_dev() in order to update the reference count of the usb device structure.

Why?