From: Michael Grzeschik Date: Sun, 17 Oct 2021 21:50:17 +0000 (+0200) Subject: usb: gadget: uvc: ensure the vdev is unset X-Git-Tag: v6.1-rc5~2730^2~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e4ce9ed835bcaf4cd3230a53a79645986c25ce0f;p=platform%2Fkernel%2Flinux-starfive.git usb: gadget: uvc: ensure the vdev is unset 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: Laurent Pinchart Reviewed-by: Paul Elder Signed-off-by: Michael Grzeschik Link: https://lore.kernel.org/r/20211017215017.18392-7-m.grzeschik@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index e6de56a..71bb5e4 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(uvc->video)); uvc->vdev.v4l2_dev = &uvc->v4l2_dev; uvc->vdev.v4l2_dev->dev = &cdev->gadget->dev; uvc->vdev.fops = &uvc_v4l2_fops;