[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1372696809-14661-1-git-send-email-alexandre.belloni@free-electrons.com>
Date: Mon, 1 Jul 2013 18:40:09 +0200
From: Alexandre Belloni <alexandre.belloni@...e-electrons.com>
To: Jonathan Cameron <jic23@....ac.uk>
Cc: Maxime Ripard <maxime.ripard@...e-electrons.com>,
Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
Gregory Clement <gregory.clement@...e-electrons.com>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
Lars-Peter Clausen <lars@...afoo.de>,
Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
<stable@...r.kernel.org>
Subject: [PATCH] iio: inkern: fix iio_convert_raw_to_processed_unlocked
When reading IIO_CHAN_INFO_OFFSET, the return value of iio_channel_read() for
success will be IIO_VAL*, checking for 0 is not correct.
Cc: <stable@...r.kernel.org> # 3.10.x
Signed-off-by: Alexandre Belloni <alexandre.belloni@...e-electrons.com>
---
drivers/iio/inkern.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 98ddc32..0cf5f8e 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -451,7 +451,7 @@ static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan,
int ret;
ret = iio_channel_read(chan, &offset, NULL, IIO_CHAN_INFO_OFFSET);
- if (ret == 0)
+ if (ret >= 0)
raw64 += offset;
scale_type = iio_channel_read(chan, &scale_val, &scale_val2,
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists