summaryrefslogtreecommitdiffstats
path: root/tools/iio
diff options
context:
space:
mode:
authorHartmut Knaack <knaack.h@gmx.de>2015-05-31 08:40:21 -0400
committerJonathan Cameron <jic23@kernel.org>2015-06-01 03:37:54 -0400
commit1e7c34788de3c0e5b18b6f27c42c191da5811c74 (patch)
tree83d75905ce0c18cb42cb131eeb8e8790b261336c /tools/iio
parentace76e42bcd5d67e5be303997a4dc325d44366ce (diff)
tools:iio:iio_utils: initialize count during declaration
In build_channel_array(), count can be initialized already during variable declaration. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'tools/iio')
-rw-r--r--tools/iio/iio_utils.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
index 7c0abb306f5a..dfee1a3f3f63 100644
--- a/tools/iio/iio_utils.c
+++ b/tools/iio/iio_utils.c
@@ -312,7 +312,7 @@ int build_channel_array(const char *device_dir,
312{ 312{
313 DIR *dp; 313 DIR *dp;
314 FILE *sysfsfp; 314 FILE *sysfsfp;
315 int count, i; 315 int count = 0, i;
316 struct iio_channel_info *current; 316 struct iio_channel_info *current;
317 int ret; 317 int ret;
318 const struct dirent *ent; 318 const struct dirent *ent;
@@ -370,7 +370,6 @@ int build_channel_array(const char *device_dir,
370 goto error_close_dir; 370 goto error_close_dir;
371 } 371 }
372 seekdir(dp, 0); 372 seekdir(dp, 0);
373 count = 0;
374 while (ent = readdir(dp), ent != NULL) { 373 while (ent = readdir(dp), ent != NULL) {
375 if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), 374 if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"),
376 "_en") == 0) { 375 "_en") == 0) {