RE: [PATCH] iio: proximity: Fix return value check of wait_for_completion_timeout

From: Sa, Nuno
Date: Tue Apr 12 2022 - 02:24:11 EST


> From: Sa, Nuno
> Sent: Tuesday, April 12, 2022 8:21 AM
> To: Miaoqian Lin <linmq006@xxxxxxxxx>; Song Qiang
> <songqiang1304521@xxxxxxxxx>; Jonathan Cameron
> <jic23@xxxxxxxxxx>; Lars-Peter Clausen <lars@xxxxxxxxxx>; Ivan
> Drobyshevskyi <drobyshevskyi@xxxxxxxxx>; linux-
> iio@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: RE: [PATCH] iio: proximity: Fix return value check of
> wait_for_completion_timeout
>
>
>
> > -----Original Message-----
> > From: Miaoqian Lin <linmq006@xxxxxxxxx>
> > Sent: Tuesday, April 12, 2022 5:00 AM
> > To: Song Qiang <songqiang1304521@xxxxxxxxx>; Jonathan Cameron
> > <jic23@xxxxxxxxxx>; Lars-Peter Clausen <lars@xxxxxxxxxx>; Ivan
> > Drobyshevskyi <drobyshevskyi@xxxxxxxxx>; linux-
> > iio@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> > Cc: linmq006@xxxxxxxxx
> > Subject: [PATCH] iio: proximity: Fix return value check of
> > wait_for_completion_timeout
> >
> > [External]
> >
> > wait_for_completion_timeout() returns unsigned long not int.
> > It returns 0 if timed out, and positive if completed.
> > The check for <= 0 is ambiguous and should be == 0 here
> > indicating timeout which is the only error case.
> >
> > Fixes: 3cef2e31b54b ("iio: proximity: vl53l0x: Add IRQ support")
> > Signed-off-by: Miaoqian Lin <linmq006@xxxxxxxxx>
> > ---
>
> Reviewed-by: Nuno Sá <nuno.sa@xxxxxxxxxx>

Hi Lin,

Just one note regarding the patch subject. You should indicate
to which driver this patch applies "iio: proximity: vl53l0x: ..."

- Nuno Sá