usb: gadget: uvc: fix error path in uvc_function_bind()
usb: gadget: uvc: fix error path in uvc_function_bind()

The "video->minor = -1" assigment is done in V4L2 by
video_register_device() so it is removed here.
Now. uvc_function_bind() calls in error case uvc_function_unbind() for
cleanup. The problem is that uvc_function_unbind() frees the uvc struct
and uvc_bind_config() does as well in error case of usb_add_function().
Removing kfree() in usb_add_function() would make the patch smaller but
it would look odd because the new allocated memory is not cleaned up.
However it is not guaranteed that if we call usb_add_function() we also
get to the bind function.
Therefore the patch extracts the conditional cleanup from
uvc_function_unbind() applies to uvc_function_bind().
uvc_function_unbind() now contains only the complete cleanup which is
required once everything has been registrated.

Cc: Laurent Pinchart <3ded2f39a78f0d7044839546f95841842b4d7c96@ideasonboard.com>
Cc: Bhupesh Sharma <4ea540b5fc8347f73706cff6303216b2e0bede0b@st.com>
Cc: stable <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <265264fed90bdf8e813a354375ec16f47ebdb1c5@linutronix.de>
Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>

KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs