linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Zhang, Qiang" <Qiang.Zhang@windriver.com>
To: "laurent.pinchart@ideasonboard.com" 
	<laurent.pinchart@ideasonboard.com>,
	"balbi@kernel.org" <balbi@kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	Alan Stern <stern@rowland.harvard.edu>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: 回复: [PATCH] usb: gadget: uvc: Fix the wrong v4l2_device_unregister call
Date: Mon, 28 Sep 2020 06:31:28 +0000	[thread overview]
Message-ID: <BYAPR11MB26322AE0FCD63AEB467D3AE3FF350@BYAPR11MB2632.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200927080116.24763-1-qiang.zhang@windriver.com>

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


      reply	other threads:[~2020-09-28  6:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BYAPR11MB26322AE0FCD63AEB467D3AE3FF350@BYAPR11MB2632.namprd11.prod.outlook.com \
    --to=qiang.zhang@windriver.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).