summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIrina Tirdea <irina.tirdea@intel.com>2016-03-24 11:09:45 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-04-20 15:45:23 +0900
commit9f1aedb42713661b6e0376a5ccc7c9daaf77a901 (patch)
treee05dff2cae13f24d97d05b705d5b48a9712e2f6b
parentfdc0a7733accb6bddf5c636afafeb5feb0a748ab (diff)
downloadlwn-9f1aedb42713661b6e0376a5ccc7c9daaf77a901.tar.gz
lwn-9f1aedb42713661b6e0376a5ccc7c9daaf77a901.zip
iio: fix config watermark initial value
commit 1bef2c1d4e4fd92bdf8219b13ba97ba861618254 upstream. config structure is set to 0 when updating the buffers, so by default config->watermark will be 0. When computing the minimum between config->watermark and the buffer->watermark or insert_buffer-watermark, this will always be 0 regardless of the value set by the user for the buffer. Set as initial value for config->watermark the maximum allowed value so that the minimum value will always be set from one of the buffers. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Fixes: f0566c0c405d ("iio: Set device watermark based on watermark of all attached buffers") Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/iio/industrialio-buffer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 139ae916225f..5b6abc541e8c 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -645,6 +645,7 @@ static int iio_verify_update(struct iio_dev *indio_dev,
unsigned int modes;
memset(config, 0, sizeof(*config));
+ config->watermark = ~0;
/*
* If there is just one buffer and we are removing it there is nothing