[PATCH 3/4] usb: gadget: uvc: improve error handling in uvcg_video_init()

Xu Yang posted 4 patches 1 month ago
There is a newer version of this series
[PATCH 3/4] usb: gadget: uvc: improve error handling in uvcg_video_init()
Posted by Xu Yang 1 month ago
Let uvcg_video_init() return correct code so that error can be handled
correctly.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
 drivers/usb/gadget/function/uvc_video.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
index b1c5c1d3e9390c82cc84e736a7f288626ee69d51..ede300190f591d39e306aecb565c614cdff5e664 100644
--- a/drivers/usb/gadget/function/uvc_video.c
+++ b/drivers/usb/gadget/function/uvc_video.c
@@ -838,7 +838,6 @@ int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc)
 	video->interval = 666666;
 
 	/* Initialize the video buffers queue. */
-	uvcg_queue_init(&video->queue, uvc->v4l2_dev.dev->parent,
+	return uvcg_queue_init(&video->queue, uvc->v4l2_dev.dev->parent,
 			V4L2_BUF_TYPE_VIDEO_OUTPUT, &video->mutex);
-	return 0;
 }

-- 
2.34.1
Re: [PATCH 3/4] usb: gadget: uvc: improve error handling in uvcg_video_init()
Posted by Frank Li 1 month ago
On Thu, Jan 08, 2026 at 03:43:04PM +0800, Xu Yang wrote:
> Let uvcg_video_init() return correct code so that error can be handled
> correctly.

usb: gadget: uvc: Return error from uvcg_queue_init()

uvcg_queue_init() may fail, but its return value is currently ignored.
Propagate the error code from uvcg_queue_init() to correctly report
initialization failures.

Frank
>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> ---
>  drivers/usb/gadget/function/uvc_video.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
> index b1c5c1d3e9390c82cc84e736a7f288626ee69d51..ede300190f591d39e306aecb565c614cdff5e664 100644
> --- a/drivers/usb/gadget/function/uvc_video.c
> +++ b/drivers/usb/gadget/function/uvc_video.c
> @@ -838,7 +838,6 @@ int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc)
>  	video->interval = 666666;
>
>  	/* Initialize the video buffers queue. */
> -	uvcg_queue_init(&video->queue, uvc->v4l2_dev.dev->parent,
> +	return uvcg_queue_init(&video->queue, uvc->v4l2_dev.dev->parent,
>  			V4L2_BUF_TYPE_VIDEO_OUTPUT, &video->mutex);
> -	return 0;
>  }
>
> --
> 2.34.1
>
Re: [PATCH 3/4] usb: gadget: uvc: improve error handling in uvcg_video_init()
Posted by Xu Yang 3 weeks, 6 days ago
On Thu, Jan 08, 2026 at 11:08:25AM -0500, Frank Li wrote:
> On Thu, Jan 08, 2026 at 03:43:04PM +0800, Xu Yang wrote:
> > Let uvcg_video_init() return correct code so that error can be handled
> > correctly.
> 
> usb: gadget: uvc: Return error from uvcg_queue_init()
> 
> uvcg_queue_init() may fail, but its return value is currently ignored.
> Propagate the error code from uvcg_queue_init() to correctly report
> initialization failures.

Ok. Thank you for provide a better commit message.

Thanks,
Xu Yang