[PATCH v2] media: pvrusb2: fix parsing error
From: Tong Zhang
Date: Wed Aug 19 2020 - 17:25:57 EST
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@xxxxxxxxx>
Signed-off-by: Tong Zhang <ztong0001@xxxxxxxxx>
---
v2: return -EINVAL as suggested by Hans Verkuil<hverkuil@xxxxxxxxx>.
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