mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tong Zhang <ztong0001@gmail.com>
To: isely@pobox.com, mchehab@kernel.org, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org, hverkuil@xs4all.nl
Cc: ztong0001@gmail.com
Subject: [PATCH v2] media: pvrusb2: fix parsing error
Date: Wed, 19 Aug 2020 17:25:23 -0400	[thread overview]
Message-ID: <20200819212523.113973-1-ztong0001@gmail.com> (raw)
In-Reply-To: <75b8354b-362a-0215-8038-45bd68be7de5@xs4all.nl>

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;
 	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;
-- 
2.25.1


  parent reply	other threads:[~2020-08-19 21:25 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   ` Tong Zhang [this message]
2020-08-20 11:44     ` [PATCH v2] " 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=20200819212523.113973-1-ztong0001@gmail.com \
    --to=ztong0001@gmail.com \
    --cc=hverkuil@xs4all.nl \
    --cc=isely@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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

all inboxes | Powered by JetHome®