All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: srf08: Remove redundant if statement
@ 2022-05-23 12:27 Li Zhengyu
  2022-05-25  6:33 ` Andreas Klinger
  0 siblings, 1 reply; 3+ messages in thread
From: Li Zhengyu @ 2022-05-23 12:27 UTC (permalink / raw)
  To: ak; +Cc: jic23, lars, linux-iio, linux-kernel

(!val) has been checked outside the loop, remove redundant (val &&)
from loop.

Signed-off-by: Li Zhengyu <lizhengyu3@huawei.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: srf08: Remove redundant if statement
  2022-05-23 12:27 [PATCH] iio: srf08: Remove redundant if statement Li Zhengyu
@ 2022-05-25  6:33 ` Andreas Klinger
  2022-05-28 17:14   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Klinger @ 2022-05-25  6:33 UTC (permalink / raw)
  To: Li Zhengyu; +Cc: jic23, lars, linux-iio, linux-kernel

Acked-by: Andreas Klinger <ak@it-klinger.de>

Li Zhengyu <lizhengyu3@huawei.com> schrieb am Mo, 23. Mai 20:27:
> (!val) has been checked outside the loop, remove redundant (val &&)
> from loop.
> 
> Signed-off-by: Li Zhengyu <lizhengyu3@huawei.com>
> ---
>  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
ak@it-klinger.de
www.it-klinger.de
www.grabenreith.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: srf08: Remove redundant if statement
  2022-05-25  6:33 ` Andreas Klinger
@ 2022-05-28 17:14   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2022-05-28 17:14 UTC (permalink / raw)
  To: Andreas Klinger; +Cc: Li Zhengyu, lars, linux-iio, linux-kernel

On Wed, 25 May 2022 08:33:38 +0200
Andreas Klinger <ak@it-klinger.de> wrote:

> Acked-by: Andreas Klinger <ak@it-klinger.de>
> 
> Li Zhengyu <lizhengyu3@huawei.com> schrieb am Mo, 23. Mai 20:27:
> > (!val) has been checked outside the loop, remove redundant (val &&)
> > from loop.
> > 
> > Signed-off-by: Li Zhengyu <lizhengyu3@huawei.com>
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
> >   
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-28 17:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23 12:27 [PATCH] iio: srf08: Remove redundant if statement Li Zhengyu
2022-05-25  6:33 ` Andreas Klinger
2022-05-28 17:14   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.