mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: iio: cdc: ad7746: set ret on IIO_VOLTAGE case
@ 2016-10-25 18:44 Colin King
  2016-10-25 18:51 ` Lars-Peter Clausen
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2016-10-25 18:44 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Hartmut Knaack, Peter Meerwald-Stadler, Greg Kroah-Hartman,
	linux-iio, devel
  Cc: linux-kernel

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

For a IIO_VOLTAGE case, ret is not being set causing an
uninitialized value being returned by ad7746_read_raw. Fix
this by setting ret to IIO_VAL_INT for this specific case.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 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 f41251c..a5828f9 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.3

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

* Re: [PATCH] staging: iio: cdc: ad7746: set ret on IIO_VOLTAGE case
  2016-10-25 18:44 [PATCH] staging: iio: cdc: ad7746: set ret on IIO_VOLTAGE case Colin King
@ 2016-10-25 18:51 ` Lars-Peter Clausen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars-Peter Clausen @ 2016-10-25 18:51 UTC (permalink / raw)
  To: Colin King, Michael Hennerich, Jonathan Cameron, Hartmut Knaack,
	Peter Meerwald-Stadler, Greg Kroah-Hartman, linux-iio, devel
  Cc: linux-kernel

On 10/25/2016 08:44 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> For a IIO_VOLTAGE case, ret is not being set causing an
> uninitialized value being returned by ad7746_read_raw. Fix
> this by setting ret to IIO_VAL_INT for this specific case.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Arnd did beat you by a few hours, https://lkml.org/lkml/2016/10/25/485

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

end of thread, other threads:[~2016-10-25 18:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-25 18:44 [PATCH] staging: iio: cdc: ad7746: set ret on IIO_VOLTAGE case Colin King
2016-10-25 18:51 ` Lars-Peter Clausen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®