Re: [PATCH] media: gspca: Add error logging for sq905c_command() to prevent silent failure
From: Hans Verkuil
Date: Tue Mar 04 2025 - 11:51:18 EST
Hi Wentao Liang,
On 03/03/2025 16:23, Wentao Liang wrote:
> Add error handling for sq905c_command() failure in sq905c_dostream().
> Log debug message with gspca_dbg() to prevent silent failure.
>
> Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
> ---
> drivers/media/usb/gspca/sq905c.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/gspca/sq905c.c b/drivers/media/usb/gspca/sq905c.c
> index 6ca947aef298..7bb6b24c3ed1 100644
> --- a/drivers/media/usb/gspca/sq905c.c
> +++ b/drivers/media/usb/gspca/sq905c.c
> @@ -183,7 +183,9 @@ static void sq905c_dostream(struct work_struct *work)
> quit_stream:
> if (gspca_dev->present) {
> mutex_lock(&gspca_dev->usb_lock);
> - sq905c_command(gspca_dev, SQ905C_CLEAR, 0);
> + ret = sq905c_command(gspca_dev, SQ905C_CLEAR, 0);
> + if (ret)
> + gspca_dbg(gspca_dev, D_STREAM, "Clear command failed\n");
Thank you for this patch, but I'm not taking it, it just adds a debug message
for no good reason that I can see. It's a really old driver as well.
If you really want it, then post the patch again and explain why you want this in.
Regards,
Hans
> mutex_unlock(&gspca_dev->usb_lock);
> }
> kfree(buffer);