media: pvrusb2: fix parsing error
authorTong Zhang <ztong0001@gmail.com>
Thu, 20 Aug 2020 16:52:40 +0000 (18:52 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 26 Aug 2020 16:50:11 +0000 (18:50 +0200)
pvr2_std_str_to_id() returns 0 on failure and 1 on success,
however the caller is checking failure case using <0

Acked-by: Mike Isely <isely@pobox.com>
Co-developed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/usb/pvrusb2/pvrusb2-hdw.c

index 1cfb7cf64131aa652f09f79b31a05b591aa3a9ad..f4a727918e352883f46ef4023b60929d43144ac8 100644 (file)
@@ -864,10 +864,9 @@ static int ctrl_std_sym_to_val(struct pvr2_ctrl *cptr,
                               const char *bufPtr,unsigned int bufSize,
                               int *mskp,int *valp)
 {
-       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;