}
 
        dp = opendir(scan_el_dir);
-       if (dp == NULL) {
+       if (!dp) {
                ret = -errno;
                goto error_free_builtname_generic;
        }
 
        ret = -ENOENT;
-       while (ent = readdir(dp), ent != NULL)
+       while (ent = readdir(dp), ent)
                /*
                 * Do we allow devices to override a generic name with
                 * a specific one?
                        }
 
                        sysfsfp = fopen(filename, "r");
-                       if (sysfsfp == NULL) {
+                       if (!sysfsfp) {
                                ret = -errno;
                                printf("failed to open %s\n", filename);
                                goto error_free_filename;
        }
 
        dp = opendir(device_dir);
-       if (dp == NULL) {
+       if (!dp) {
                ret = -errno;
                goto error_free_builtname_generic;
        }
 
        ret = -ENOENT;
-       while (ent = readdir(dp), ent != NULL)
+       while (ent = readdir(dp), ent)
                if ((strcmp(builtname, ent->d_name) == 0) ||
                    (strcmp(builtname_generic, ent->d_name) == 0)) {
                        ret = asprintf(&filename,
                return -ENOMEM;
 
        dp = opendir(scan_el_dir);
-       if (dp == NULL) {
+       if (!dp) {
                ret = -errno;
                goto error_free_name;
        }
 
-       while (ent = readdir(dp), ent != NULL)
+       while (ent = readdir(dp), ent)
                if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"),
                           "_en") == 0) {
                        ret = asprintf(&filename,
                        }
 
                        sysfsfp = fopen(filename, "r");
-                       if (sysfsfp == NULL) {
+                       if (!sysfsfp) {
                                ret = -errno;
                                free(filename);
                                goto error_close_dir;
                }
 
        *ci_array = malloc(sizeof(**ci_array) * (*counter));
-       if (*ci_array == NULL) {
+       if (!*ci_array) {
                ret = -ENOMEM;
                goto error_close_dir;
        }
 
        seekdir(dp, 0);
-       while (ent = readdir(dp), ent != NULL) {
+       while (ent = readdir(dp), ent) {
                if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"),
                           "_en") == 0) {
                        int current_enabled = 0;
                        }
 
                        sysfsfp = fopen(filename, "r");
-                       if (sysfsfp == NULL) {
+                       if (!sysfsfp) {
                                ret = -errno;
                                free(filename);
                                count--;
                        current->name = strndup(ent->d_name,
                                                strlen(ent->d_name) -
                                                strlen("_en"));
-                       if (current->name == NULL) {
+                       if (!current->name) {
                                free(filename);
                                ret = -ENOMEM;
                                count--;
                        }
 
                        sysfsfp = fopen(filename, "r");
-                       if (sysfsfp == NULL) {
+                       if (!sysfsfp) {
                                ret = -errno;
                                printf("failed to open %s\n", filename);
                                free(filename);
        char *filename;
 
        dp = opendir(iio_dir);
-       if (dp == NULL) {
+       if (!dp) {
                printf("No industrialio devices available\n");
                return -ENODEV;
        }
 
-       while (ent = readdir(dp), ent != NULL) {
+       while (ent = readdir(dp), ent) {
                if (strcmp(ent->d_name, ".") != 0 &&
                    strcmp(ent->d_name, "..") != 0 &&
                    strlen(ent->d_name) > strlen(type) &&
                            ":", 1) != 0) {
                                filename = malloc(strlen(iio_dir) + strlen(type)
                                                  + numstrlen + 6);
-                               if (filename == NULL) {
+                               if (!filename) {
                                        ret = -ENOMEM;
                                        goto error_close_dir;
                                }
        int test;
        char *temp = malloc(strlen(basedir) + strlen(filename) + 2);
 
-       if (temp == NULL)
+       if (!temp)
                return -ENOMEM;
 
        ret = sprintf(temp, "%s/%s", basedir, filename);
                goto error_free;
 
        sysfsfp = fopen(temp, "w");
-       if (sysfsfp == NULL) {
+       if (!sysfsfp) {
                ret = -errno;
                printf("failed to open %s\n", temp);
                goto error_free;
 
        if (verify) {
                sysfsfp = fopen(temp, "r");
-               if (sysfsfp == NULL) {
+               if (!sysfsfp) {
                        ret = -errno;
                        printf("failed to open %s\n", temp);
                        goto error_free;
        FILE  *sysfsfp;
        char *temp = malloc(strlen(basedir) + strlen(filename) + 2);
 
-       if (temp == NULL) {
+       if (!temp) {
                printf("Memory allocation failed\n");
                return -ENOMEM;
        }
                goto error_free;
 
        sysfsfp = fopen(temp, "w");
-       if (sysfsfp == NULL) {
+       if (!sysfsfp) {
                ret = -errno;
                printf("Could not open %s\n", temp);
                goto error_free;
 
        if (verify) {
                sysfsfp = fopen(temp, "r");
-               if (sysfsfp == NULL) {
+               if (!sysfsfp) {
                        ret = -errno;
                        printf("Could not open file to verify\n");
                        goto error_free;
        FILE  *sysfsfp;
        char *temp = malloc(strlen(basedir) + strlen(filename) + 2);
 
-       if (temp == NULL) {
+       if (!temp) {
                printf("Memory allocation failed");
                return -ENOMEM;
        }
                goto error_free;
 
        sysfsfp = fopen(temp, "r");
-       if (sysfsfp == NULL) {
+       if (!sysfsfp) {
                ret = -errno;
                goto error_free;
        }
        FILE  *sysfsfp;
        char *temp = malloc(strlen(basedir) + strlen(filename) + 2);
 
-       if (temp == NULL) {
+       if (!temp) {
                printf("Memory allocation failed");
                return -ENOMEM;
        }
                goto error_free;
 
        sysfsfp = fopen(temp, "r");
-       if (sysfsfp == NULL) {
+       if (!sysfsfp) {
                ret = -errno;
                goto error_free;
        }
        FILE  *sysfsfp;
        char *temp = malloc(strlen(basedir) + strlen(filename) + 2);
 
-       if (temp == NULL) {
+       if (!temp) {
                printf("Memory allocation failed");
                return -ENOMEM;
        }
                goto error_free;
 
        sysfsfp = fopen(temp, "r");
-       if (sysfsfp == NULL) {
+       if (!sysfsfp) {
                ret = -errno;
                goto error_free;
        }
 
        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);
        DIR *dp;
 
        dp = opendir(iio_dir);
-       if (dp == NULL) {
+       if (!dp) {
                printf("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;
 
                }
        }
        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;