Thread (9 messages) 9 messages, 2 authors, 2021-10-04
STALE1716d REVIEWED: 1 (1M)
Revisions (3)
  1. v1 [diff vs current]
  2. v2 current
  3. v3 [diff vs current]

[PATCH v2 6/7] usb: gadget: uvc: ensure the vdev is unset

From: Michael Grzeschik <hidden>
Date: 2021-10-03 20:29:48
Subsystem: the rest, usb subsystem, usb webcam gadget · Maintainers: Linus Torvalds, Greg Kroah-Hartman

Since the uvc video device is created on demand, we have to ensure
that the struct is always zeroed. Otherwise the previous settings
might collide with the new values.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Michael Grzeschik <redacted>
---
v2: - added reviewed by
    - fixed patch description

 drivers/usb/gadget/function/f_uvc.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index 1e93ab5c0c88d..b3279ba357331 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -417,6 +417,7 @@ uvc_register_video(struct uvc_device *uvc)
 	int ret;
 
 	/* TODO reference counting. */
+	memset(&uvc->vdev, 0, sizeof(struct video_device));
 	uvc->vdev.v4l2_dev = &uvc->v4l2_dev;
 	uvc->vdev.v4l2_dev->dev = &cdev->gadget->dev;
 	uvc->vdev.fops = &uvc_v4l2_fops;
-- 
2.30.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help