linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kieran Bingham <kieran.bingham@ideasonboard.com>
To: Andreas Pape <ap@ca-pape.de>, linux-media@vger.kernel.org
Subject: Re: [PATCH 3/3] media: stkwebcam: Bugfix for wrong return values
Date: Mon, 26 Nov 2018 12:33:04 +0000	[thread overview]
Message-ID: <d68bde4f-1148-ad5e-37d7-f8c1d102b687@ideasonboard.com> (raw)
In-Reply-To: <20181123161454.3215-4-ap@ca-pape.de>

Hi Andreas,

Thank you for the patch,

On 23/11/2018 16:14, Andreas Pape wrote:
> usb_control_msg returns in case of a successfully sent message the number
> of sent bytes as a positive number. Don't use this value as a return value
> for stk_camera_read_reg, as a non-zero return value is used as an error
> condition in some cases when stk_camera_read_reg is called.

Yes, and I see the stk_camera_write_reg() also follows this pattern.


> Signed-off-by: Andreas Pape <ap@ca-pape.de>
> ---
>  drivers/media/usb/stkwebcam/stk-webcam.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c
> index c64928e36a5a..66a3665fc826 100644
> --- a/drivers/media/usb/stkwebcam/stk-webcam.c
> +++ b/drivers/media/usb/stkwebcam/stk-webcam.c
> @@ -171,7 +171,11 @@ int stk_camera_read_reg(struct stk_camera *dev, u16 index, u8 *value)
>  		*value = *buf;
>  
>  	kfree(buf);
> -	return ret;
> +
> +	if (ret < 0)
> +		return ret;
> +	else
> +		return 0;

I would have said the return 0; could be on it's own, and the else
statement would then not be needed, but I see this follows the style
used by stk_camera_write_reg() - so it looks good to me.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>


>  }
>  
>  static int stk_start_stream(struct stk_camera *dev)
> 

-- 
Regards
--
Kieran

      reply	other threads:[~2018-11-26 23:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-23 16:14 [PATCH 0/3] Fix for webcam issues with ASUS A6VM Andreas Pape
2018-11-23 16:14 ` [PATCH 1/3] media: stkwebcam: Support for ASUS A6VM notebook added Andreas Pape
2018-11-26 12:48   ` Kieran Bingham
2018-11-30 15:07     ` Andreas Pape
2018-11-23 16:14 ` [PATCH 2/3] media: stkwebcam: Bugfix for not correctly initialized camera Andreas Pape
2018-11-26 12:48   ` Kieran Bingham
2018-11-30 14:58     ` Andreas Pape
2018-12-05 18:56       ` Mauro Carvalho Chehab
2018-12-05 19:08         ` Mauro Carvalho Chehab
2018-11-23 16:14 ` [PATCH 3/3] media: stkwebcam: Bugfix for wrong return values Andreas Pape
2018-11-26 12:33   ` Kieran Bingham [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d68bde4f-1148-ad5e-37d7-f8c1d102b687@ideasonboard.com \
    --to=kieran.bingham@ideasonboard.com \
    --cc=ap@ca-pape.de \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).