]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drivers/iio/inkern.c: fix iio_convert_raw_to_processed_unlocked()
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>
Wed, 3 Jul 2013 00:22:13 +0000 (10:22 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 17 Jul 2013 02:35:01 +0000 (12:35 +1000)
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.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Jonathan Cameron <jic23@cam.ac.uk>
Cc: <stable@vger.kernel.org> [3.10.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/iio/inkern.c

index 98ddc323add011fe84e45abc4f8902ce9e7f09af..0cf5f8e06cfcc6b6bc8c059871e153a391cbd122 100644 (file)
@@ -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,