diff options
Diffstat (limited to 'tools/iio/lsiio.c')
-rw-r--r-- | tools/iio/lsiio.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/iio/lsiio.c b/tools/iio/lsiio.c index 7f432a5..3d650e6 100644 --- a/tools/iio/lsiio.c +++ b/tools/iio/lsiio.c @@ -46,10 +46,10 @@ static int dump_channels(const char *dev_dir_name) const struct dirent *ent; dp = opendir(dev_dir_name); - if (dp == NULL) + if (!dp) return -errno; - while (ent = readdir(dp), ent != NULL) + while (ent = readdir(dp), ent) if (check_prefix(ent->d_name, "in_") && check_postfix(ent->d_name, "_raw")) printf(" %-10s\n", ent->d_name); @@ -69,7 +69,7 @@ static int dump_one_device(const char *dev_dir_name) return -EINVAL; ret = read_sysfs_string("name", dev_dir_name, name); - if (ret) + if (ret < 0) return ret; printf("Device %03d: %s\n", dev_idx, name); @@ -92,7 +92,7 @@ static int dump_one_trigger(const char *dev_dir_name) return -EINVAL; ret = read_sysfs_string("name", dev_dir_name, name); - if (ret) + if (ret < 0) return ret; printf("Trigger %03d: %s\n", dev_idx, name); @@ -107,12 +107,12 @@ static int dump_devices(void) DIR *dp; dp = opendir(iio_dir); - if (dp == NULL) { - printf("No industrial I/O devices available\n"); + if (!dp) { + fprintf(stderr, "No industrial I/O devices available\n"); return -ENODEV; } - while (ent = readdir(dp), ent != NULL) { + while (ent = readdir(dp), ent) { if (check_prefix(ent->d_name, type_device)) { char *dev_dir_name; @@ -134,7 +134,7 @@ static int dump_devices(void) } } rewinddir(dp); - while (ent = readdir(dp), ent != NULL) { + while (ent = readdir(dp), ent) { if (check_prefix(ent->d_name, type_trigger)) { char *dev_dir_name; |