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:
Robin van der Gracht 2014-09-29 15:00:07 +02:00 committed by Jonathan Cameron
parent 6822ee34ad
commit 4250c90b30
1 changed files with 1 additions and 1 deletions

View File

@ -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