diff options
author | Peter Meerwald <pmeerw@pmeerw.net> | 2015-06-22 00:50:21 +0300 |
---|---|---|
committer | Luis Henriques <luis.henriques@canonical.com> | 2015-08-10 11:54:08 +0300 |
commit | 4e882ddc85e8fc4557506d295db91a59404811ac (patch) | |
tree | d2eb39c447a9fc4eb323170bdd4ce78ad7c79ed5 /drivers/iio | |
parent | 2b24558c2b70db4d0b36efcc38936b2ad8d983b9 (diff) | |
download | linux-4e882ddc85e8fc4557506d295db91a59404811ac.tar.xz |
iio: tmp006: Check channel info on write
commit 8d05abfaeff52bdf66aba3a3a337dcdbdb4911bf upstream.
only SAMP_FREQ is writable
Will lead to SAMP_FREQ being written by any attempt to write
to the other exported attributes and hence a rather unexpected
result!
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/temperature/tmp006.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c index 84a0789c3d96..7a8050996b4e 100644 --- a/drivers/iio/temperature/tmp006.c +++ b/drivers/iio/temperature/tmp006.c @@ -132,6 +132,9 @@ static int tmp006_write_raw(struct iio_dev *indio_dev, struct tmp006_data *data = iio_priv(indio_dev); int i; + if (mask != IIO_CHAN_INFO_SAMP_FREQ) + return -EINVAL; + for (i = 0; i < ARRAY_SIZE(tmp006_freqs); i++) if ((val == tmp006_freqs[i][0]) && (val2 == tmp006_freqs[i][1])) { |