Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Zqiang <qiang.zhang@windriver.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>

authored by

Zqiang and committed by
Felipe Balbi
f0c48566 7f2958d9

+4 -4
+4 -4
drivers/usb/gadget/function/f_uvc.c
··· 740 740 /* Initialise video. */ 741 741 ret = uvcg_video_init(&uvc->video, uvc); 742 742 if (ret < 0) 743 - goto error; 743 + goto v4l2_error; 744 744 745 745 /* Register a V4L2 device. */ 746 746 ret = uvc_register_video(uvc); 747 747 if (ret < 0) { 748 748 uvcg_err(f, "failed to register video device\n"); 749 - goto error; 749 + goto v4l2_error; 750 750 } 751 751 752 752 return 0; 753 753 754 - error: 754 + v4l2_error: 755 755 v4l2_device_unregister(&uvc->v4l2_dev); 756 - 756 + error: 757 757 if (uvc->control_req) 758 758 usb_ep_free_request(cdev->gadget->ep0, uvc->control_req); 759 759 kfree(uvc->control_buf);