mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Tong Zhang <ztong0001@gmail.com>,
	isely@pobox.com, mchehab@kernel.org, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] media: pvrusb2: fix parsing error
Date: Thu, 20 Aug 2020 13:44:44 +0200	[thread overview]
Message-ID: <aed971ed-bd8e-eaed-b2ee-80e9654f24cd@xs4all.nl> (raw)
In-Reply-To: <20200819212523.113973-1-ztong0001@gmail.com>

On 19/08/2020 23:25, Tong Zhang wrote:
> pvr2_std_str_to_id() returns 0 on failure and 1 on success,
> however the caller is checking failure case using <0
> 
> Co-developed-by: Hans Verkuil<hverkuil@xs4all.nl>
> Signed-off-by: Tong Zhang <ztong0001@gmail.com>
> ---
> 
> v2: return -EINVAL as suggested by Hans Verkuil<hverkuil@xs4all.nl>.
> I also rebased the code on v5.9-rc1.
> 
>  drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
> index 1cfb7cf64131..6a444cb27e31 100644
> --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
> +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
> @@ -866,8 +866,8 @@ static int ctrl_std_sym_to_val(struct pvr2_ctrl *cptr,
>  {
>  	int ret;

This is no longer used, so can be removed.

And if I compile this patch I get this warning:

drivers/media/usb/pvrusb2/pvrusb2-hdw.c: In function ‘ctrl_std_sym_to_val’:
drivers/media/usb/pvrusb2/pvrusb2-hdw.c:867:6: warning: unused variable ‘ret’ [-Wunused-variable]
  867 |  int ret;
      |      ^~~

Always compile-test before posting a patch :-)

Regards,

	Hans

>  	v4l2_std_id id;
> -	ret = pvr2_std_str_to_id(&id,bufPtr,bufSize);
> -	if (ret < 0) return ret;
> +	if (!pvr2_std_str_to_id(&id, bufPtr, bufSize))
> +		return -EINVAL;
>  	if (mskp) *mskp = id;
>  	if (valp) *valp = id;
>  	return 0;
> 


  reply	other threads:[~2020-08-20 11:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-16  6:49 [PATCH] " Tong Zhang
2020-08-19 14:38 ` Hans Verkuil
2020-08-19 16:37   ` Tong Zhang
2020-08-19 21:25   ` [PATCH v2] " Tong Zhang
2020-08-20 11:44     ` Hans Verkuil [this message]
2020-08-20 16:52       ` [PATCH v3] " Tong Zhang
2020-08-20 16:55         ` Mike Isely
2020-08-20 16:55       ` [PATCH v2] " Tong Zhang
2020-08-19 21:26   ` [PATCH] " Tong Zhang

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=aed971ed-bd8e-eaed-b2ee-80e9654f24cd@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=isely@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ztong0001@gmail.com \
    /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

all inboxes | Powered by JetHome®