]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
iio: iio_buffer_register: Use correct channel when calculating masklength
authorLars-Peter Clausen <lars@metafoo.de>
Mon, 2 Jul 2012 12:52:56 +0000 (14:52 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 8 Jul 2012 19:02:23 +0000 (20:02 +0100)
The channel set assigned to the iio device is not necessarily the same has the
channel set passed to iio_buffer_register. So to avoid possible complications
always work with the channel set pass to iio_buffer_register and ignore the
channel set assigned to the iio device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/industrialio-buffer.c

index 3d8d187eef2acf19b1a625fb48ae188442c49dc3..096a6bfe0cdfadf5d49873c6464c86199ee477d3 100644 (file)
@@ -292,7 +292,7 @@ int iio_buffer_register(struct iio_dev *indio_dev,
                        if (channels[i].scan_index >
                            (int)indio_dev->masklength - 1)
                                indio_dev->masklength
-                                       = indio_dev->channels[i].scan_index + 1;
+                                       = channels[i].scan_index + 1;
 
                        ret = iio_buffer_add_channel_sysfs(indio_dev,
                                                         &channels[i]);