All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] iio: adc: ad7476: remove redundant null check on an array
@ 2020-04-24 13:04 ` Colin King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2020-04-24 13:04 UTC (permalink / raw)
  To: Dragos Bogdan, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler,
	linux-iio
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The null check on st->chip_info->convst_channel is redundant because
convst_channel is a 2 element array of struct iio_chan_spec objects
and this can never be null. Fix this by removing the null check.

Addresses-Coverity: ("Array compared against 0")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/iio/adc/ad7476.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
index e9984a38fc4c..4e816d714ad2 100644
--- a/drivers/iio/adc/ad7476.c
+++ b/drivers/iio/adc/ad7476.c
@@ -309,7 +309,7 @@ static int ad7476_probe(struct spi_device *spi)
 	indio_dev->num_channels = 2;
 	indio_dev->info = &ad7476_info;
 
-	if (st->convst_gpio && st->chip_info->convst_channel)
+	if (st->convst_gpio)
 		indio_dev->channels = st->chip_info->convst_channel;
 	/* Setup default message */
 
-- 
2.25.1

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

* [PATCH][next] iio: adc: ad7476: remove redundant null check on an array
@ 2020-04-24 13:04 ` Colin King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2020-04-24 13:04 UTC (permalink / raw)
  To: Dragos Bogdan, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler,
	linux-iio
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The null check on st->chip_info->convst_channel is redundant because
convst_channel is a 2 element array of struct iio_chan_spec objects
and this can never be null. Fix this by removing the null check.

Addresses-Coverity: ("Array compared against 0")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/iio/adc/ad7476.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
index e9984a38fc4c..4e816d714ad2 100644
--- a/drivers/iio/adc/ad7476.c
+++ b/drivers/iio/adc/ad7476.c
@@ -309,7 +309,7 @@ static int ad7476_probe(struct spi_device *spi)
 	indio_dev->num_channels = 2;
 	indio_dev->info = &ad7476_info;
 
-	if (st->convst_gpio && st->chip_info->convst_channel)
+	if (st->convst_gpio)
 		indio_dev->channels = st->chip_info->convst_channel;
 	/* Setup default message */
 
-- 
2.25.1


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

* Re: [PATCH][next] iio: adc: ad7476: remove redundant null check on an array
  2020-04-24 13:04 ` Colin King
@ 2020-04-24 15:01   ` Ardelean, Alexandru
  -1 siblings, 0 replies; 8+ messages in thread
From: Ardelean, Alexandru @ 2020-04-24 15:01 UTC (permalink / raw)
  To: lars@metafoo.de, linux-iio@vger.kernel.org, Bogdan, Dragos,
	pmeerw@pmeerw.net, knaack.h@gmx.de, colin.king@canonical.com,
	Hennerich, Michael, jic23@kernel.org
  Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org

T24gRnJpLCAyMDIwLTA0LTI0IGF0IDE0OjA0ICswMTAwLCBDb2xpbiBLaW5nIHdyb3RlOg0KPiBG
cm9tOiBDb2xpbiBJYW4gS2luZyA8Y29saW4ua2luZ0BjYW5vbmljYWwuY29tPg0KPiANCj4gVGhl
IG51bGwgY2hlY2sgb24gc3QtPmNoaXBfaW5mby0+Y29udnN0X2NoYW5uZWwgaXMgcmVkdW5kYW50
IGJlY2F1c2UNCj4gY29udnN0X2NoYW5uZWwgaXMgYSAyIGVsZW1lbnQgYXJyYXkgb2Ygc3RydWN0
IGlpb19jaGFuX3NwZWMgb2JqZWN0cw0KPiBhbmQgdGhpcyBjYW4gbmV2ZX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pcF9pbmZvLT5jb252c3RfY2hhbm5lbDsNCj4gIAkvKiBTZXR1
cCBkZWZhdWx0IG1lc3NhZ2UgKi8NCj4gIA0K

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

* Re: [PATCH][next] iio: adc: ad7476: remove redundant null check on an array
@ 2020-04-24 15:01   ` Ardelean, Alexandru
  0 siblings, 0 replies; 8+ messages in thread
From: Ardelean, Alexandru @ 2020-04-24 15:01 UTC (permalink / raw)
  To: lars@metafoo.de, linux-iio@vger.kernel.org, Bogdan, Dragos,
	pmeerw@pmeerw.net, knaack.h@gmx.de, colin.king@canonical.com,
	Hennerich, Michael, jic23@kernel.org
  Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org

On Fri, 2020-04-24 at 14:04 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The null check on st->chip_info->convst_channel is redundant because
> convst_channel is a 2 element array of struct iio_chan_spec objects
> and this can never be null. Fix this by removing the null check.
> 

Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

> Addresses-Coverity: ("Array compared against 0")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/iio/adc/ad7476.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
> index e9984a38fc4c..4e816d714ad2 100644
> --- a/drivers/iio/adc/ad7476.c
> +++ b/drivers/iio/adc/ad7476.c
> @@ -309,7 +309,7 @@ static int ad7476_probe(struct spi_device *spi)
>  	indio_dev->num_channels = 2;
>  	indio_dev->info = &ad7476_info;
>  
> -	if (st->convst_gpio && st->chip_info->convst_channel)
> +	if (st->convst_gpio)
>  		indio_dev->channels = st->chip_info->convst_channel;
>  	/* Setup default message */
>  

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

* Re: [PATCH][next] iio: adc: ad7476: remove redundant null check on an array
  2020-04-24 15:01   ` Ardelean, Alexandru
@ 2020-04-25 17:01     ` Jonathan Cameron
  -1 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2020-04-25 17:01 UTC (permalink / raw)
  To: Ardelean, Alexandru
  Cc: lars@metafoo.de, linux-iio@vger.kernel.org, Bogdan, Dragos,
	pmeerw@pmeerw.net, knaack.h@gmx.de, colin.king@canonical.com,
	Hennerich, Michael, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Fri, 24 Apr 2020 15:01:26 +0000
"Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:

> On Fri, 2020-04-24 at 14:04 +0100, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> > 
> > The null check on st->chip_info->convst_channel is redundant because
> > convst_channel is a 2 element array of struct iio_chan_spec objects
> > and this can never be null. Fix this by removing the null check.
> >   
> 
> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Applied to the togreg branch of iio.git and pushed out as testing.
I didn't take this as a fix as it's not doing any harm in the meantime
whilst this patch goes the slow route.

Thanks,

Jonathan

> 
> > Addresses-Coverity: ("Array compared against 0")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> >  drivers/iio/adc/ad7476.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
> > index e9984a38fc4c..4e816d714ad2 100644
> > --- a/drivers/iio/adc/ad7476.c
> > +++ b/drivers/iio/adc/ad7476.c
> > @@ -309,7 +309,7 @@ static int ad7476_probe(struct spi_device *spi)
> >  	indio_dev->num_channels = 2;
> >  	indio_dev->info = &ad7476_info;
> >  
> > -	if (st->convst_gpio && st->chip_info->convst_channel)
> > +	if (st->convst_gpio)
> >  		indio_dev->channels = st->chip_info->convst_channel;
> >  	/* Setup default message */
> >    

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

* Re: [PATCH][next] iio: adc: ad7476: remove redundant null check on an array
@ 2020-04-25 17:01     ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2020-04-25 17:01 UTC (permalink / raw)
  To: Ardelean, Alexandru
  Cc: lars@metafoo.de, linux-iio@vger.kernel.org, Bogdan, Dragos,
	pmeerw@pmeerw.net, knaack.h@gmx.de, colin.king@canonical.com,
	Hennerich, Michael, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Fri, 24 Apr 2020 15:01:26 +0000
"Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:

> On Fri, 2020-04-24 at 14:04 +0100, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> > 
> > The null check on st->chip_info->convst_channel is redundant because
> > convst_channel is a 2 element array of struct iio_chan_spec objects
> > and this can never be null. Fix this by removing the null check.
> >   
> 
> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Applied to the togreg branch of iio.git and pushed out as testing.
I didn't take this as a fix as it's not doing any harm in the meantime
whilst this patch goes the slow route.

Thanks,

Jonathan

> 
> > Addresses-Coverity: ("Array compared against 0")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> >  drivers/iio/adc/ad7476.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
> > index e9984a38fc4c..4e816d714ad2 100644
> > --- a/drivers/iio/adc/ad7476.c
> > +++ b/drivers/iio/adc/ad7476.c
> > @@ -309,7 +309,7 @@ static int ad7476_probe(struct spi_device *spi)
> >  	indio_dev->num_channels = 2;
> >  	indio_dev->info = &ad7476_info;
> >  
> > -	if (st->convst_gpio && st->chip_info->convst_channel)
> > +	if (st->convst_gpio)
> >  		indio_dev->channels = st->chip_info->convst_channel;
> >  	/* Setup default message */
> >    


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

* Re: [PATCH][next] iio: adc: ad7476: remove redundant null check on an array
  2020-04-25 17:01     ` Jonathan Cameron
@ 2020-04-25 17:02       ` Jonathan Cameron
  -1 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2020-04-25 17:02 UTC (permalink / raw)
  To: Ardelean, Alexandru
  Cc: lars@metafoo.de, linux-iio@vger.kernel.org, Bogdan, Dragos,
	pmeerw@pmeerw.net, knaack.h@gmx.de, colin.king@canonical.com,
	Hennerich, Michael, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Sat, 25 Apr 2020 18:01:10 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Fri, 24 Apr 2020 15:01:26 +0000
> "Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:
> 
> > On Fri, 2020-04-24 at 14:04 +0100, Colin King wrote:  
> > > From: Colin Ian King <colin.king@canonical.com>
> > > 
> > > The null check on st->chip_info->convst_channel is redundant because
> > > convst_channel is a 2 element array of struct iio_chan_spec objects
> > > and this can never be null. Fix this by removing the null check.
> > >     
> > 
> > Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>  
> Applied to the togreg branch of iio.git and pushed out as testing.
> I didn't take this as a fix as it's not doing any harm in the meantime
> whilst this patch goes the slow route.
Just noticed this is in next only currently!  Hence can definitely
got he slow route as doesn't apply to mainline :)

Jonathan

> 
> Thanks,
> 
> Jonathan
> 
> >   
> > > Addresses-Coverity: ("Array compared against 0")
> > > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > > ---
> > >  drivers/iio/adc/ad7476.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
> > > index e9984a38fc4c..4e816d714ad2 100644
> > > --- a/drivers/iio/adc/ad7476.c
> > > +++ b/drivers/iio/adc/ad7476.c
> > > @@ -309,7 +309,7 @@ static int ad7476_probe(struct spi_device *spi)
> > >  	indio_dev->num_channels = 2;
> > >  	indio_dev->info = &ad7476_info;
> > >  
> > > -	if (st->convst_gpio && st->chip_info->convst_channel)
> > > +	if (st->convst_gpio)
> > >  		indio_dev->channels = st->chip_info->convst_channel;
> > >  	/* Setup default message */
> > >      
> 

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

* Re: [PATCH][next] iio: adc: ad7476: remove redundant null check on an array
@ 2020-04-25 17:02       ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2020-04-25 17:02 UTC (permalink / raw)
  To: Ardelean, Alexandru
  Cc: lars@metafoo.de, linux-iio@vger.kernel.org, Bogdan, Dragos,
	pmeerw@pmeerw.net, knaack.h@gmx.de, colin.king@canonical.com,
	Hennerich, Michael, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Sat, 25 Apr 2020 18:01:10 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Fri, 24 Apr 2020 15:01:26 +0000
> "Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:
> 
> > On Fri, 2020-04-24 at 14:04 +0100, Colin King wrote:  
> > > From: Colin Ian King <colin.king@canonical.com>
> > > 
> > > The null check on st->chip_info->convst_channel is redundant because
> > > convst_channel is a 2 element array of struct iio_chan_spec objects
> > > and this can never be null. Fix this by removing the null check.
> > >     
> > 
> > Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>  
> Applied to the togreg branch of iio.git and pushed out as testing.
> I didn't take this as a fix as it's not doing any harm in the meantime
> whilst this patch goes the slow route.
Just noticed this is in next only currently!  Hence can definitely
got he slow route as doesn't apply to mainline :)

Jonathan

> 
> Thanks,
> 
> Jonathan
> 
> >   
> > > Addresses-Coverity: ("Array compared against 0")
> > > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > > ---
> > >  drivers/iio/adc/ad7476.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
> > > index e9984a38fc4c..4e816d714ad2 100644
> > > --- a/drivers/iio/adc/ad7476.c
> > > +++ b/drivers/iio/adc/ad7476.c
> > > @@ -309,7 +309,7 @@ static int ad7476_probe(struct spi_device *spi)
> > >  	indio_dev->num_channels = 2;
> > >  	indio_dev->info = &ad7476_info;
> > >  
> > > -	if (st->convst_gpio && st->chip_info->convst_channel)
> > > +	if (st->convst_gpio)
> > >  		indio_dev->channels = st->chip_info->convst_channel;
> > >  	/* Setup default message */
> > >      
> 


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

end of thread, other threads:[~2020-04-25 17:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-24 13:04 [PATCH][next] iio: adc: ad7476: remove redundant null check on an array Colin King
2020-04-24 13:04 ` Colin King
2020-04-24 15:01 ` Ardelean, Alexandru
2020-04-24 15:01   ` Ardelean, Alexandru
2020-04-25 17:01   ` Jonathan Cameron
2020-04-25 17:01     ` Jonathan Cameron
2020-04-25 17:02     ` Jonathan Cameron
2020-04-25 17:02       ` 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.