Commit f0c48566 authored by Zqiang's avatar Zqiang Committed by Felipe Balbi

usb: gadget: uvc: Fix the wrong v4l2_device_unregister call

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: default avatarZqiang <qiang.zhang@windriver.com>
Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
parent 7f2958d9
...@@ -740,20 +740,20 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) ...@@ -740,20 +740,20 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
/* Initialise video. */ /* Initialise video. */
ret = uvcg_video_init(&uvc->video, uvc); ret = uvcg_video_init(&uvc->video, uvc);
if (ret < 0) if (ret < 0)
goto error; goto v4l2_error;
/* Register a V4L2 device. */ /* Register a V4L2 device. */
ret = uvc_register_video(uvc); ret = uvc_register_video(uvc);
if (ret < 0) { if (ret < 0) {
uvcg_err(f, "failed to register video device\n"); uvcg_err(f, "failed to register video device\n");
goto error; goto v4l2_error;
} }
return 0; return 0;
error: v4l2_error:
v4l2_device_unregister(&uvc->v4l2_dev); v4l2_device_unregister(&uvc->v4l2_dev);
error:
if (uvc->control_req) if (uvc->control_req)
usb_ep_free_request(cdev->gadget->ep0, uvc->control_req); usb_ep_free_request(cdev->gadget->ep0, uvc->control_req);
kfree(uvc->control_buf); kfree(uvc->control_buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment