[PATCH 4.5 098/124] iio: fix config watermark initial value
From: Greg Kroah-Hartman
Date: Sun Apr 17 2016 - 22:34:03 EST
4.5-stable review patch. If anyone has any objections, please let me know.
From: Irina Tirdea <irina.tirdea@xxxxxxxxx>
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
Signed-off-by: Irina Tirdea <irina.tirdea@xxxxxxxxx>
Fixes: f0566c0c405d ("iio: Set device watermark based on watermark of all
Signed-off-by: Jonathan Cameron <jic23@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
drivers/iio/industrialio-buffer.c | 1 +
1 file changed, 1 insertion(+)
@@ -645,6 +645,7 @@ static int iio_verify_update(struct iio_
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