2022-05-25 19:57:03

by Andreas Klinger

[permalink] [raw]
Subject: Re: [PATCH] iio: srf08: Remove redundant if statement

Acked-by: Andreas Klinger <[email protected]>

Li Zhengyu <[email protected]> schrieb am Mo, 23. Mai 20:27:
> (!val) has been checked outside the loop, remove redundant (val &&)
> from loop.
>
> Signed-off-by: Li Zhengyu <[email protected]>
> ---
> drivers/iio/proximity/srf08.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c
> index ac1ab7e89d4e..7ed11339c31e 100644
> --- a/drivers/iio/proximity/srf08.c
> +++ b/drivers/iio/proximity/srf08.c
> @@ -354,7 +354,7 @@ static ssize_t srf08_write_sensitivity(struct srf08_data *data,
> return -EINVAL;
>
> for (i = 0; i < data->chip_info->num_sensitivity_avail; i++)
> - if (val && (val == data->chip_info->sensitivity_avail[i])) {
> + if (val == data->chip_info->sensitivity_avail[i]) {
> regval = i;
> break;
> }
> --
> 2.17.1
>

--
Andreas Klinger
Grabenreith 27
84508 Burgkirchen
+49 8623 919966
[email protected]
http://www.it-klinger.de
http://www.grabenreith.de


2022-05-28 20:30:28

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH] iio: srf08: Remove redundant if statement

On Wed, 25 May 2022 08:33:38 +0200
Andreas Klinger <[email protected]> wrote:

> Acked-by: Andreas Klinger <[email protected]>
>
> Li Zhengyu <[email protected]> schrieb am Mo, 23. Mai 20:27:
> > (!val) has been checked outside the loop, remove redundant (val &&)
> > from loop.
> >
> > Signed-off-by: Li Zhengyu <[email protected]>
Hi Li Zhengyu,

Applied to the togreg branch of iio.git which is initially pushed out as testing
or 0-day to see if we missed anything.

I'll push it out for linux-next to pick up once the merge window closes.

Thanks,

Jonathan

> > ---
> > drivers/iio/proximity/srf08.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c
> > index ac1ab7e89d4e..7ed11339c31e 100644
> > --- a/drivers/iio/proximity/srf08.c
> > +++ b/drivers/iio/proximity/srf08.c
> > @@ -354,7 +354,7 @@ static ssize_t srf08_write_sensitivity(struct srf08_data *data,
> > return -EINVAL;
> >
> > for (i = 0; i < data->chip_info->num_sensitivity_avail; i++)
> > - if (val && (val == data->chip_info->sensitivity_avail[i])) {
> > + if (val == data->chip_info->sensitivity_avail[i]) {
> > regval = i;
> > break;
> > }
> > --
> > 2.17.1
> >
>