mirror of https://gitee.com/openkylin/linux.git
iio: st_sensors: Fix buffer copy
Use byte_for_channel as iterator to properly initialize the buffer. Signed-off-by: Robin van der Gracht <robin@protonic.nl> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: <Stable@vger.kernel.org>
This commit is contained in:
parent
6822ee34ad
commit
4250c90b30
|
@ -71,7 +71,7 @@ int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf)
|
|||
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)
|
||||
buf[i] = rx_array[i];
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue