summaryrefslogtreecommitdiffstats
path: root/tools/iio/iio_utils.c
diff options
context:
space:
mode:
authorJoo Aun Saw <jasaw@dius.com.au>2015-07-24 17:23:29 +0200
committerJonathan Cameron <jic23@kernel.org>2015-08-08 20:54:00 +0200
commit95ddd3f4b17e1df20b5e23d7b81614e7c8a643da (patch)
tree5635b52796aa2fd9973c3269b212bd4d54eb8c05 /tools/iio/iio_utils.c
parenttools: iio: Set caller's ci_array pointer to NULL after free (diff)
downloadlinux-95ddd3f4b17e1df20b5e23d7b81614e7c8a643da.tar.xz
linux-95ddd3f4b17e1df20b5e23d7b81614e7c8a643da.zip
tools: iio: remove unnecessary double pointer
Remove unnecessary double pointer from channel sorting function. Signed-off-by: Joo Aun Saw <jasaw@dius.com.au> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'tools/iio/iio_utils.c')
-rw-r--r--tools/iio/iio_utils.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
index 8475b832ee39..5eb6793f3972 100644
--- a/tools/iio/iio_utils.c
+++ b/tools/iio/iio_utils.c
@@ -286,17 +286,17 @@ error_free_builtname:
* @cnt: the amount of array elements
**/
-void bsort_channel_array_by_index(struct iio_channel_info **ci_array, int cnt)
+void bsort_channel_array_by_index(struct iio_channel_info *ci_array, int cnt)
{
struct iio_channel_info temp;
int x, y;
for (x = 0; x < cnt; x++)
for (y = 0; y < (cnt - 1); y++)
- if ((*ci_array)[y].index > (*ci_array)[y + 1].index) {
- temp = (*ci_array)[y + 1];
- (*ci_array)[y + 1] = (*ci_array)[y];
- (*ci_array)[y] = temp;
+ if (ci_array[y].index > ci_array[y + 1].index) {
+ temp = ci_array[y + 1];
+ ci_array[y + 1] = ci_array[y];
+ ci_array[y] = temp;
}
}
@@ -516,7 +516,7 @@ int build_channel_array(const char *device_dir,
free(scan_el_dir);
/* reorder so that the array is in index order */
- bsort_channel_array_by_index(ci_array, *counter);
+ bsort_channel_array_by_index(*ci_array, *counter);
return 0;