Commit 1e7c3478 authored by Hartmut Knaack's avatar Hartmut Knaack Committed by Jonathan Cameron

tools:iio:iio_utils: initialize count during declaration

In build_channel_array(), count can be initialized already during variable
declaration.
Signed-off-by: default avatarHartmut Knaack <knaack.h@gmx.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent ace76e42
...@@ -312,7 +312,7 @@ int build_channel_array(const char *device_dir, ...@@ -312,7 +312,7 @@ int build_channel_array(const char *device_dir,
{ {
DIR *dp; DIR *dp;
FILE *sysfsfp; FILE *sysfsfp;
int count, i; int count = 0, i;
struct iio_channel_info *current; struct iio_channel_info *current;
int ret; int ret;
const struct dirent *ent; const struct dirent *ent;
...@@ -370,7 +370,6 @@ int build_channel_array(const char *device_dir, ...@@ -370,7 +370,6 @@ int build_channel_array(const char *device_dir,
goto error_close_dir; goto error_close_dir;
} }
seekdir(dp, 0); seekdir(dp, 0);
count = 0;
while (ent = readdir(dp), ent != NULL) { while (ent = readdir(dp), ent != NULL) {
if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"),
"_en") == 0) { "_en") == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment