Skip to content

Commit

Permalink
iio: fix config watermark initial value
Browse files Browse the repository at this point in the history
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: f0566c0 ("iio: Set device watermark based on watermark of all
attached buffers")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Irina Tirdea authored and Jonathan Cameron committed Mar 28, 2016
1 parent b74fcca commit 1bef2c1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/iio/industrialio-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1bef2c1

Please sign in to comment.