linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: uvc: Fix the wrong v4l2_device_unregister call
@ 2020-09-27  8:01 qiang.zhang
  2020-09-28  6:31 ` 回复: " Zhang, Qiang
  0 siblings, 1 reply; 2+ messages in thread
From: qiang.zhang @ 2020-09-27  8:01 UTC (permalink / raw)
  To: laurent.pinchart, balbi, gregkh; +Cc: linux-usb

From: Zqiang <qiang.zhang@windriver.com>

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

Signed-off-by: Zqiang <qiang.zhang@windriver.com>
---
 drivers/usb/gadget/function/f_uvc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index 0b9712616455..44b4352a2676 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* 回复: [PATCH] usb: gadget: uvc: Fix the wrong v4l2_device_unregister call
  2020-09-27  8:01 [PATCH] usb: gadget: uvc: Fix the wrong v4l2_device_unregister call qiang.zhang
@ 2020-09-28  6:31 ` Zhang, Qiang
  0 siblings, 0 replies; 2+ messages in thread
From: Zhang, Qiang @ 2020-09-28  6:31 UTC (permalink / raw)
  To: laurent.pinchart, balbi, gregkh, Alan Stern; +Cc: linux-usb

Cc: Alan Stern

________________________________________
发件人: qiang.zhang@windriver.com <qiang.zhang@windriver.com>
发送时间: 2020年9月27日 16:01
收件人: laurent.pinchart@ideasonboard.com; balbi@kernel.org; gregkh@linuxfoundation.org
抄送: linux-usb@vger.kernel.org
主题: [PATCH] usb: gadget: uvc: Fix the wrong v4l2_device_unregister call

From: Zqiang <qiang.zhang@windriver.com>

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

Signed-off-by: Zqiang <qiang.zhang@windriver.com>
---
 drivers/usb/gadget/function/f_uvc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index 0b9712616455..44b4352a2676 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-28  6:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-27  8:01 [PATCH] usb: gadget: uvc: Fix the wrong v4l2_device_unregister call qiang.zhang
2020-09-28  6:31 ` 回复: " Zhang, Qiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).