Skip to contentSkip to conversation

iio: st_sensors: Fix buffer copy

PATCH Applied Robin van der Gracht 3 participants 3 messages Sep 29, 2014 – Oct 4, 2014 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: st_sensors: Fix buffer copy

Use byte_for_channel as iterator to properly initialize the buffer.

---
 drivers/iio/common/st_sensors/st_sensors_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/common/st_sensors/st_sensors_buffer.c +1 -1
index 1665c8e..e18bc67 100644
@@ -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
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw

Thanks!

Denis

Quoted 20 lines · Robin van der Gracht

Use byte_for_channel as iterator to properly initialize the buffer.

---
  drivers/iio/common/st_sensors/st_sensors_buffer.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/common/st_sensors/st_sensors_buffer.c +1 -1
index 1665c8e..e18bc67 100644
@@ -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
maintainer Applied
#2 lore raw
Quoted 1 line · Denis CIOCCA

Applied to fixes-togreg branch of iio.git and marked for stable.

Note that given the timing this will probably not hit mainline until after the coming merge window. Only after that will it get picked up for stable.

Jonathan

Quoted 31 lines

Thanks!

Denis

Quoted 12 lines · Robin van der Gracht

Use byte_for_channel as iterator to properly initialize the buffer.

---
  drivers/iio/common/st_sensors/st_sensors_buffer.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/common/st_sensors/st_sensors_buffer.c +0 -0
index 1665c8e..e18bc67 100644

drivers/iio/common/st_sensors/st_sensors_buffer.c int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf) · line 77

Quoted 8 lines
drivers/iio/common/st_sensors/st_sensors_buffer.c +1 -1
@@ -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

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html