summaryrefslogtreecommitdiff
path: root/drivers/iio/inkern.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-01-09 04:59:04 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-01-09 04:59:04 +0300
commit8ecb55b849b74dff026681b41266970072b207dd (patch)
tree0304ed3e252374adf0f5b3ec5eb0de0700a9e130 /drivers/iio/inkern.c
parentb7392d2247cfe6771f95d256374f1a8e6a6f48d6 (diff)
parent65de7654d39c70c2b942f801cea01590cf7e3458 (diff)
downloadlinux-8ecb55b849b74dff026681b41266970072b207dd.tar.xz
Merge tag 'iio-fixes-for-3.19a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes: First round of IIO fixes for the 3.19 cycle. * ad799x fix ad7991/ad7995/ad7999 setup as they do not have a configuration register to write to. It is written during the convesion sequence. As such we don't want to write to it at other times. * Fix iio_channel_read utility function to return to ensure it is apparent if the relevant element is not there. This avoids using a wrong value if some channels have the element and others do not.
Diffstat (limited to 'drivers/iio/inkern.c')
-rw-r--r--drivers/iio/inkern.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 866fe904cba2..90c8cb727cc7 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -449,6 +449,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;
+
if (chan->indio_dev->info->read_raw_multi) {
ret = chan->indio_dev->info->read_raw_multi(chan->indio_dev,
chan->channel, INDIO_MAX_RAW_ELEMENTS,