Skip to contentSkip to conversation

iio: --/++ confusion in build_channel_array() error cleanup

PATCH In review roel kluin 2 participants 2 messages Jan 1, 2011

Subsystems (3)
lore
Share & tools
lore

roel kluin

author
#0 lore raw

PATCH 1/1 iio: --/++ confusion in build_channel_array() error cleanup

Fix loop: it should decrement

---
 drivers/staging/iio/Documentation/iio_utils.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/iio/Documentation/iio_utils.h +1 -1
index 0372424..4dc961c 100644
@@ -398,7 +398,7 @@ inline int build_channel_array(const char *device_dir,
 	return 0;
 
 error_cleanup_array:
-	for (i = count - 1;  i >= 0; i++)
+	for (i = count - 1;  i >= 0; i--)
 		free((*ci_array)[i].name);
 	free(*ci_array);
 error_close_dir:
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · roel kluin

Fix loop: it should decrement

Good spot.

cc'd Greg KH for merging into staging.

Quoted 1 line
Quoted 18 lines
---
 drivers/staging/iio/Documentation/iio_utils.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/iio/Documentation/iio_utils.h +1 -1
index 0372424..4dc961c 100644
@@ -398,7 +398,7 @@ inline int build_channel_array(const char *device_dir,
 	return 0;
 
 error_cleanup_array:
-	for (i = count - 1;  i >= 0; i++)
+	for (i = count - 1;  i >= 0; i--)
 		free((*ci_array)[i].name);
 	free(*ci_array);
 error_close_dir: