Commit c6b4cac2 authored by Robin van der Gracht's avatar Robin van der Gracht Committed by Jonathan Cameron

iio: st_sensors: Fix buffer copy

Use byte_for_channel as iterator to properly initialize the buffer.
Signed-off-by: default avatarRobin van der Gracht <robin@protonic.nl>
Acked-by: default avatarDenis Ciocca <denis.ciocca@st.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
Cc: <Stable@vger.kernel.org>
parent 97fb3033
...@@ -71,7 +71,7 @@ int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf) ...@@ -71,7 +71,7 @@ int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf)
goto st_sensors_free_memory; goto st_sensors_free_memory;
} }
for (i = 0; i < n * num_data_channels; i++) { for (i = 0; i < n * byte_for_channel; i++) {
if (i < n) if (i < n)
buf[i] = rx_array[i]; buf[i] = rx_array[i];
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment