aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lechner <dlechner@baylibre.com>2024-04-25 10:03:29 -0500
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2024-04-29 20:53:24 +0100
commit79df437b5661b2f7e1c0bad097fd18c4e154bb94 (patch)
treec3e8916967400255a7f589e4f9fd6bec9a7e9af2
parent75616d2e3c9ecb22e41c2bf455d1588ee05f02e2 (diff)
downloadiio-79df437b5661b2f7e1c0bad097fd18c4e154bb94.tar.gz
iio: buffer: initialize masklength accumulator to 0
Since masklength is marked as [INTERN], no drivers should assign it and the value will always be 0. Therefore, the local ml accumulator variable in iio_buffers_alloc_sysfs_and_mask() will always start out as 0. This changes the code to explicitly set ml to 0 to make it clear that drivers should not be trying to override the masklength field. Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://lore.kernel.org/r/20240425-b4-iio-masklength-cleanup-v1-3-d3d16318274d@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r--drivers/iio/industrialio-buffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 1d950a3e153b8a..cec58a604d73a9 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -1744,7 +1744,7 @@ int iio_buffers_alloc_sysfs_and_mask(struct iio_dev *indio_dev)
channels = indio_dev->channels;
if (channels) {
- int ml = indio_dev->masklength;
+ int ml = 0;
for (i = 0; i < indio_dev->num_channels; i++)
ml = max(ml, channels[i].scan_index + 1);