Skip to contentSkip to conversation

usb: gadget: uvc: Fix the wrong v4l2_device_unregister call

PATCH In review [email protected] 1 participant 2 messages Sep 27, 2020 – Sep 28, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: gadget: uvc: Fix the wrong v4l2_device_unregister call

From: Zqiang <[email protected]>

If an error occurred before calling the 'v4l2_device_register' func, and then goto error, but no need to call 'v4l2_device_unregister' func.

---
 drivers/usb/gadget/function/f_uvc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/gadget/function/f_uvc.c +4 -4
index 0b9712616455..44b4352a2676 100644
@@ -740,20 +740,20 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
 	/* Initialise video. */
 	ret = uvcg_video_init(&uvc->video, uvc);
 	if (ret < 0)
-		goto error;
+		goto v4l2_error;
 
 	/* Register a V4L2 device. */
 	ret = uvc_register_video(uvc);
 	if (ret < 0) {
 		uvcg_err(f, "failed to register video device\n");
-		goto error;
+		goto v4l2_error;
 	}
 
 	return 0;
 
-error:
+v4l2_error:
 	v4l2_device_unregister(&uvc->v4l2_dev);
-
+error:
 	if (uvc->control_req)
 		usb_ep_free_request(cdev->gadget->ep0, uvc->control_req);
 	kfree(uvc->control_buf);
Signature · 1 line
2.17.1
#1 lore raw
Cc Alan Stern

________________________________________
发件人: [email protected] <[email protected]>
发送时间: 2020年9月27日 16:01
收件人: [email protected]; [email protected]; [email protected] 抄送: [email protected]
主题: [PATCH] usb: gadget: uvc: Fix the wrong v4l2_device_unregister call

From: Zqiang <[email protected]>

If an error occurred before calling the 'v4l2_device_register' func, and then goto error, but no need to call 'v4l2_device_unregister' func.

---
 drivers/usb/gadget/function/f_uvc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/gadget/function/f_uvc.c +4 -4
index 0b9712616455..44b4352a2676 100644
@@ -740,20 +740,20 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
        /* Initialise video. */
        ret = uvcg_video_init(&uvc->video, uvc);
        if (ret < 0)
-               goto error;
+               goto v4l2_error;
 
        /* Register a V4L2 device. */
        ret = uvc_register_video(uvc);
        if (ret < 0) {
                uvcg_err(f, "failed to register video device\n");
-               goto error;
+               goto v4l2_error;
        }
 
        return 0;
 
-error:
+v4l2_error:
        v4l2_device_unregister(&uvc->v4l2_dev);
-
+error:
        if (uvc->control_req)
                usb_ep_free_request(cdev->gadget->ep0, uvc->control_req);
        kfree(uvc->control_buf);

--
2.17.1