[PATCH 28/32] tools:iio:iio_utils: initialize count during declaration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In build_channel_array(), count can be initialized already during variable
declaration.

Signed-off-by: Hartmut Knaack <knaack.h@xxxxxx>
---
 tools/iio/iio_utils.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
index 7c0abb3..dfee1a3 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,
 {
 	DIR *dp;
 	FILE *sysfsfp;
-	int count, i;
+	int count = 0, i;
 	struct iio_channel_info *current;
 	int ret;
 	const struct dirent *ent;
@@ -370,7 +370,6 @@ int build_channel_array(const char *device_dir,
 		goto error_close_dir;
 	}
 	seekdir(dp, 0);
-	count = 0;
 	while (ent = readdir(dp), ent != NULL) {
 		if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"),
 			   "_en") == 0) {
-- 
2.3.6

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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux