summary refs log tree commit diff
path: root/drivers/iio/industrialio-buffer.c
diff options
context:
space:
mode:
authorIrina Tirdea <irina.tirdea@intel.com>2016-03-24 11:09:45 +0200
committerJonathan Cameron <jic23@kernel.org>2016-03-28 11:00:38 +0100
commit1bef2c1d4e4fd92bdf8219b13ba97ba861618254 (patch)
treeee078e95414d0ba2448085213c05972aabd83f92 /drivers/iio/industrialio-buffer.c
parentb74fccad751d2664bda9dd3c90646bb61295e774 (diff)
downloadlinux-1bef2c1d4e4fd92bdf8219b13ba97ba861618254.tar.gz
iio: fix config watermark initial value
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")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/industrialio-buffer.c')
-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 b976332d45d3..90462fcf5436 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -653,6 +653,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