Skip to content

Commit

Permalink
usb: gadget: uvc: Fix the wrong v4l2_device_unregister call
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
  • Loading branch information
Zqiang authored and Felipe Balbi committed Oct 2, 2020
1 parent 7f2958d commit f0c4856
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/usb/gadget/function/f_uvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f0c4856

Please sign in to comment.