From: Hans Verkuil <hverkuil@xs4all.nl>
To: Tong Zhang <ztong0001@gmail.com>,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
mchehab@kernel.org, isely@pobox.com
Subject: Re: [PATCH] media: pvrusb2: fix parsing error
Date: Wed, 19 Aug 2020 16:38:00 +0200 [thread overview]
Message-ID: <75b8354b-362a-0215-8038-45bd68be7de5@xs4all.nl> (raw)
In-Reply-To: <20200816064901.977682-1-ztong0001@gmail.com>
Hi Tong,
On 16/08/2020 08:49, 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
>
> Signed-off-by: Tong Zhang <ztong0001@gmail.com>
> ---
> drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
> index 1cfb7cf64131..db5aa66c1936 100644
> --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
> +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
> @@ -867,7 +867,8 @@ static int ctrl_std_sym_to_val(struct pvr2_ctrl *cptr,
> int ret;
> v4l2_std_id id;
> ret = pvr2_std_str_to_id(&id,bufPtr,bufSize);
> - if (ret < 0) return ret;
> + if (ret == 0)
> + return ret;
But now you return 0 instead of an error when pvr2_std_str_to_id failed.
Just do this:
if (!pvr2_std_str_to_id(&id,bufPtr,bufSize))
return -EINVAL;
And you can drop the ret variable as well since that's no longer needed.
Regards,
Hans
> if (mskp) *mskp = id;
> if (valp) *valp = id;
> return 0;
>
next prev parent reply other threads:[~2020-08-19 14:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-16 6:49 [PATCH] media: pvrusb2: fix parsing error Tong Zhang
2020-08-19 14:38 ` Hans Verkuil [this message]
2020-08-19 16:37 ` Tong Zhang
2020-08-19 21:25 ` [PATCH v2] " Tong Zhang
2020-08-20 11:44 ` Hans Verkuil
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=75b8354b-362a-0215-8038-45bd68be7de5@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;
as well as URLs for NNTP newsgroup(s).