Re: [PATCH] 0001-xilinx-xadc-core-Fix-voltage-offset.patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From bdeab2d72a00587eac15eb91ec0820ff6d11bfe8 Mon Sep 17 00:00:00 2001
From: Fabien Proriol <fabien.proriol@xxxxxxxx>
Date: Mon, 17 Nov 2014 09:46:02 +0100
Subject: [PATCH] iio: Fix iio_channel_read return if channel havn't info

iio_channel_read must return an error to avoid offset for channel
without IIO_CHAN_INFO_OFFSET property

Signed-off-by: Fabien Proriol <fabien.proriol@xxxxxxxx>
---
 drivers/iio/inkern.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 1e8e94d..917eb00 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -423,6 +423,9 @@ static int iio_channel_read(struct iio_channel *chan, int *val, int *val2,
 	if (val2 == NULL)
 		val2 = &unused;
 
+	if(!iio_channel_has_info(chan->channel, info))
+		return -EINVAL;
+
 	return chan->indio_dev->info->read_raw(chan->indio_dev, chan->channel,
 						val, val2, info);
 }
-- 
2.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux