All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] iio:ad7923: Return error if we didn't get the expected result
@ 2013-03-04 19:30 Lars-Peter Clausen
  2013-03-04 19:30 ` [PATCH 2/3] iio:ad7923: Implement scale reporting Lars-Peter Clausen
  2013-03-04 19:30 ` [PATCH 3/3] iio:adc:ad7923: Add support for the ad7904/ad7914/ad7924 Lars-Peter Clausen
  0 siblings, 2 replies; 4+ messages in thread
From: Lars-Peter Clausen @ 2013-03-04 19:30 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Lars-Peter Clausen, Patrick Vasseur, Christophe Leroy

Instead of leaving 'val' uninitialized return an error if the result's address
did not match that of the channel we were trying to read.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Patrick Vasseur <patrick.vasseur@c-s.fr>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>
---
 drivers/iio/adc/ad7923.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/adc/ad7923.c b/drivers/iio/adc/ad7923.c
index 766c740..36eee24 100644
--- a/drivers/iio/adc/ad7923.c
+++ b/drivers/iio/adc/ad7923.c
@@ -199,6 +199,8 @@ static int ad7923_read_raw(struct iio_dev *indio_dev,
 
 		if (chan->address == EXTRACT(ret, 12, 4))
 			*val = EXTRACT(ret, 0, 12);
+		else
+			return -EIO;
 
 		return IIO_VAL_INT;
 	}
-- 
1.8.0

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

end of thread, other threads:[~2013-03-17 22:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-04 19:30 [PATCH 1/3] iio:ad7923: Return error if we didn't get the expected result Lars-Peter Clausen
2013-03-04 19:30 ` [PATCH 2/3] iio:ad7923: Implement scale reporting Lars-Peter Clausen
2013-03-04 19:30 ` [PATCH 3/3] iio:adc:ad7923: Add support for the ad7904/ad7914/ad7924 Lars-Peter Clausen
2013-03-17 20:18   ` 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.