[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAA5qM4BqzwiRijEkk=0EEGCwgjm1BnN3RbT2=51z0pzCGHqngg@mail.gmail.com>
Date: Wed, 19 Aug 2020 12:37:20 -0400
From: Tong Zhang <ztong0001@...il.com>
To: Hans Verkuil <hverkuil@...all.nl>
Cc: linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
mchehab@...nel.org, isely@...ox.com
Subject: Re: [PATCH] media: pvrusb2: fix parsing error
Hi Hans,
Thank you very much for your comments.
The change looks good to me.
-- However, I'm not quite familiar with the patch submission process
in this situation.
Would you like to go ahead and create an improved version?
Thanks,
- Tong
On Wed, Aug 19, 2020 at 10:38 AM Hans Verkuil <hverkuil@...all.nl> wrote:
>
> 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@...il.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;
> >
>
Powered by blists - more mailing lists