All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: iio: cdc/ad7746: fix missing return value
@ 2016-10-25 15:56 Arnd Bergmann
  2016-10-25 16:27 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2016-10-25 15:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arnd Bergmann, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler,
	Eva Rachel Retuya, linux-iio, devel, linux-kernel

As found by "gcc -Wmaybe-uninitialized", the latest change to the
driver lacked an initalization for the return code in one of the
added cases:

drivers/staging/iio/cdc/ad7746.c: In function ‘ad7746_read_raw’:
drivers/staging/iio/cdc/ad7746.c:655:2: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

This sets it to IIO_VAL_INT, which I think is what we want here.

Fixes: 2296c0623eb7 ("staging: iio: cdc: ad7746: implement IIO_CHAN_INFO_SAMP_FREQ")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/iio/cdc/ad7746.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
index f41251ceeacd..a5828f9aa437 100644
--- a/drivers/staging/iio/cdc/ad7746.c
+++ b/drivers/staging/iio/cdc/ad7746.c
@@ -642,6 +642,7 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,
 		case IIO_VOLTAGE:
 			*val = ad7746_vt_filter_rate_table[
 					(chip->config >> 6) & 0x3][0];
+			ret = IIO_VAL_INT;
 			break;
 		default:
 			ret = -EINVAL;
-- 
2.9.0

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

* Re: [PATCH] staging: iio: cdc/ad7746: fix missing return value
  2016-10-25 15:56 [PATCH] staging: iio: cdc/ad7746: fix missing return value Arnd Bergmann
@ 2016-10-25 16:27 ` Jonathan Cameron
  2016-10-26  9:48   ` Eva Rachel Retuya
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2016-10-25 16:27 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman
  Cc: Lars-Peter Clausen, Michael Hennerich, Hartmut Knaack,
	Peter Meerwald-Stadler, Eva Rachel Retuya, linux-iio, devel,
	linux-kernel

On 25/10/16 16:56, Arnd Bergmann wrote:
> As found by "gcc -Wmaybe-uninitialized", the latest change to the
> driver lacked an initalization for the return code in one of the
> added cases:
> 
> drivers/staging/iio/cdc/ad7746.c: In function ‘ad7746_read_raw’:
> drivers/staging/iio/cdc/ad7746.c:655:2: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> This sets it to IIO_VAL_INT, which I think is what we want here.
> 
> Fixes: 2296c0623eb7 ("staging: iio: cdc: ad7746: implement IIO_CHAN_INFO_SAMP_FREQ")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Gah, not a good bit of reviewing from me. Should have caught that one.  Thanks Arnd.

Applied to the togreg branch of iio.git - initially pushed out as testing for the
autobuilders to play with it.  Will probably be a little while before I send
another pull to Greg (most likely the weekend)

Thanks again,

Jonathan
> ---
>  drivers/staging/iio/cdc/ad7746.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
> index f41251ceeacd..a5828f9aa437 100644
> --- a/drivers/staging/iio/cdc/ad7746.c
> +++ b/drivers/staging/iio/cdc/ad7746.c
> @@ -642,6 +642,7 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,
>  		case IIO_VOLTAGE:
>  			*val = ad7746_vt_filter_rate_table[
>  					(chip->config >> 6) & 0x3][0];
> +			ret = IIO_VAL_INT;
>  			break;
>  		default:
>  			ret = -EINVAL;
> 

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

* Re: [PATCH] staging: iio: cdc/ad7746: fix missing return value
  2016-10-25 16:27 ` Jonathan Cameron
@ 2016-10-26  9:48   ` Eva Rachel Retuya
  0 siblings, 0 replies; 3+ messages in thread
From: Eva Rachel Retuya @ 2016-10-26  9:48 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Lars-Peter Clausen,
	Michael Hennerich, Hartmut Knaack, Peter Meerwald-Stadler,
	linux-iio, devel, linux-kernel

On Tue, Oct 25, 2016 at 05:27:07PM +0100, Jonathan Cameron wrote:
> On 25/10/16 16:56, Arnd Bergmann wrote:
> > As found by "gcc -Wmaybe-uninitialized", the latest change to the
> > driver lacked an initalization for the return code in one of the
> > added cases:
> > 
> > drivers/staging/iio/cdc/ad7746.c: In function ‘ad7746_read_raw’:
> > drivers/staging/iio/cdc/ad7746.c:655:2: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > 
> > This sets it to IIO_VAL_INT, which I think is what we want here.
> > 
> > Fixes: 2296c0623eb7 ("staging: iio: cdc: ad7746: implement IIO_CHAN_INFO_SAMP_FREQ")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Gah, not a good bit of reviewing from me. Should have caught that one.  Thanks Arnd.
> 

It's not your fault. My apologies. v1 of this patch is OK, I just happen to 
encounter a problem and had to rework the v2 on another branch resulting
to this blunder.

I will be extra careful next time.

Eva

> Applied to the togreg branch of iio.git - initially pushed out as testing for the
> autobuilders to play with it.  Will probably be a little while before I send
> another pull to Greg (most likely the weekend)
> 
> Thanks again,
> 
> Jonathan
> > ---
> >  drivers/staging/iio/cdc/ad7746.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
> > index f41251ceeacd..a5828f9aa437 100644
> > --- a/drivers/staging/iio/cdc/ad7746.c
> > +++ b/drivers/staging/iio/cdc/ad7746.c
> > @@ -642,6 +642,7 @@ static int ad7746_read_raw(struct iio_dev *indio_dev,
> >  		case IIO_VOLTAGE:
> >  			*val = ad7746_vt_filter_rate_table[
> >  					(chip->config >> 6) & 0x3][0];
> > +			ret = IIO_VAL_INT;
> >  			break;
> >  		default:
> >  			ret = -EINVAL;
> > 
> 

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

end of thread, other threads:[~2016-10-26  9:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-25 15:56 [PATCH] staging: iio: cdc/ad7746: fix missing return value Arnd Bergmann
2016-10-25 16:27 ` Jonathan Cameron
2016-10-26  9:48   ` Eva Rachel Retuya

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.