Commit 138d2d88 authored by Robin van der Gracht's avatar Robin van der Gracht Committed by Luis Henriques

iio: st_sensors: Fix buffer copy

commit 4250c90b upstream.

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>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent f0903fbf
...@@ -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