Skip to content

Commit

Permalink
iio: st_sensors: Fix buffer copy
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Robin van der Gracht authored and Jonathan Cameron committed Oct 4, 2014
1 parent 6822ee3 commit 4250c90
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/common/st_sensors/st_sensors_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4250c90

Please sign in to comment.