Re: [PATCH 1/3] tools: iio: Remove explicit NULL comparison
On 13/07/15 19:46, Hartmut Knaack wrote: > Cristina Opriceana schrieb am 13.07.2015 um 15:15: >> Remove explicit NULL comparison and write it in its simpler form as >> recommended by checkpatch.pl. >> >> Signed-off-by: Cristina Opriceana > Reviewed-by: Hartmut Knaack Applied to the togreg branch of iio.git. Thanks, Jonathan >> --- > > Every instance covered, consistency improved. Not everyone will mind that, > but good job. > >> tools/iio/generic_buffer.c | 4 ++-- >> tools/iio/iio_utils.c | 56 >> +++--- >> tools/iio/lsiio.c | 10 - >> 3 files changed, 35 insertions(+), 35 deletions(-) >> >> diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c >> index 0e73723..9535c2d 100644 >> --- a/tools/iio/generic_buffer.c >> +++ b/tools/iio/generic_buffer.c >> @@ -270,7 +270,7 @@ int main(int argc, char **argv) >> } >> } >> >> -if (device_name == NULL) { >> +if (!device_name) { >> printf("Device name not set\n"); >> print_usage(); >> return -1; >> @@ -290,7 +290,7 @@ int main(int argc, char **argv) >> return -ENOMEM; >> >> if (!notrigger) { >> -if (trigger_name == NULL) { >> +if (!trigger_name) { >> /* >> * Build the trigger name. If it is device associated >> * its name is _dev[n] where n matches >> diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c >> index 8fb3214..4a7e480 100644 >> --- a/tools/iio/iio_utils.c >> +++ b/tools/iio/iio_utils.c >> @@ -117,13 +117,13 @@ int iioutils_get_type(unsigned *is_signed, unsigned >> *bytes, unsigned *bits_used, >> } >> >> 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? >> @@ -138,7 +138,7 @@ int iioutils_get_type(unsigned *is_signed, unsigned >> *bytes, unsigned *bits_used, >> } >> >> sysfsfp = fopen(filename, "r"); >> -if (sysfsfp == NULL) { >> +if (!sysfsfp) { >> ret = -errno; >> printf("failed to open %s\n", filename); >> goto error_free_filename; >> @@ -235,13 +235,13 @@ int iioutils_get_param_float(float *output, const char >> *param_name, >> } >> >> 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(, >> @@ -325,12 +325,12 @@ int build_channel_array(const char *device_dir, >> 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(, >> @@ -341,7 +341,7 @@ int build_channel_array(const char *device_dir, >> } >> >> sysfsfp = fopen(filename, "r"); >> -if (sysfsfp == NULL) { >> +if (!sysfsfp) { >> ret = -errno; >> free(filename); >> goto error_close_dir; >> @@ -369,13 +369,13 @@ int build_channel_array(const char *device_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; >> @@ -391,7 +391,7 @@ int build_channel_array(const char *device_dir, >> } >> >> sysfsfp = fopen(filename, "r"); >> -if (sysfsfp == NULL) { >> +if (!sysfsfp) { >> ret = -errno; >>
Re: [PATCH 1/3] tools: iio: Remove explicit NULL comparison
On 13/07/15 19:46, Hartmut Knaack wrote: Cristina Opriceana schrieb am 13.07.2015 um 15:15: Remove explicit NULL comparison and write it in its simpler form as recommended by checkpatch.pl. Signed-off-by: Cristina Opriceana cristina.oprice...@gmail.com Reviewed-by: Hartmut Knaack knaac...@gmx.de Applied to the togreg branch of iio.git. Thanks, Jonathan --- Every instance covered, consistency improved. Not everyone will mind that, but good job. tools/iio/generic_buffer.c | 4 ++-- tools/iio/iio_utils.c | 56 +++--- tools/iio/lsiio.c | 10 - 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index 0e73723..9535c2d 100644 --- a/tools/iio/generic_buffer.c +++ b/tools/iio/generic_buffer.c @@ -270,7 +270,7 @@ int main(int argc, char **argv) } } -if (device_name == NULL) { +if (!device_name) { printf(Device name not set\n); print_usage(); return -1; @@ -290,7 +290,7 @@ int main(int argc, char **argv) return -ENOMEM; if (!notrigger) { -if (trigger_name == NULL) { +if (!trigger_name) { /* * Build the trigger name. If it is device associated * its name is device_name_dev[n] where n matches diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 8fb3214..4a7e480 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -117,13 +117,13 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, } 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? @@ -138,7 +138,7 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, } sysfsfp = fopen(filename, r); -if (sysfsfp == NULL) { +if (!sysfsfp) { ret = -errno; printf(failed to open %s\n, filename); goto error_free_filename; @@ -235,13 +235,13 @@ int iioutils_get_param_float(float *output, const char *param_name, } 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, @@ -325,12 +325,12 @@ int build_channel_array(const char *device_dir, 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, @@ -341,7 +341,7 @@ int build_channel_array(const char *device_dir, } sysfsfp = fopen(filename, r); -if (sysfsfp == NULL) { +if (!sysfsfp) { ret = -errno; free(filename); goto error_close_dir; @@ -369,13 +369,13 @@ int build_channel_array(const char *device_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; @@ -391,7 +391,7 @@ int build_channel_array(const char *device_dir, } sysfsfp = fopen(filename, r); -if (sysfsfp == NULL) { +if (!sysfsfp) { ret = -errno; free(filename); count--; @@ -424,7 +424,7 @@ int build_channel_array(const char *device_dir, current-name = strndup(ent-d_name,
Re: [PATCH 1/3] tools: iio: Remove explicit NULL comparison
Cristina Opriceana schrieb am 13.07.2015 um 15:15: > Remove explicit NULL comparison and write it in its simpler form as > recommended by checkpatch.pl. > > Signed-off-by: Cristina Opriceana Reviewed-by: Hartmut Knaack > --- Every instance covered, consistency improved. Not everyone will mind that, but good job. > tools/iio/generic_buffer.c | 4 ++-- > tools/iio/iio_utils.c | 56 > +++--- > tools/iio/lsiio.c | 10 - > 3 files changed, 35 insertions(+), 35 deletions(-) > > diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c > index 0e73723..9535c2d 100644 > --- a/tools/iio/generic_buffer.c > +++ b/tools/iio/generic_buffer.c > @@ -270,7 +270,7 @@ int main(int argc, char **argv) > } > } > > - if (device_name == NULL) { > + if (!device_name) { > printf("Device name not set\n"); > print_usage(); > return -1; > @@ -290,7 +290,7 @@ int main(int argc, char **argv) > return -ENOMEM; > > if (!notrigger) { > - if (trigger_name == NULL) { > + if (!trigger_name) { > /* >* Build the trigger name. If it is device associated >* its name is _dev[n] where n matches > diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c > index 8fb3214..4a7e480 100644 > --- a/tools/iio/iio_utils.c > +++ b/tools/iio/iio_utils.c > @@ -117,13 +117,13 @@ int iioutils_get_type(unsigned *is_signed, unsigned > *bytes, unsigned *bits_used, > } > > 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? > @@ -138,7 +138,7 @@ int iioutils_get_type(unsigned *is_signed, unsigned > *bytes, unsigned *bits_used, > } > > sysfsfp = fopen(filename, "r"); > - if (sysfsfp == NULL) { > + if (!sysfsfp) { > ret = -errno; > printf("failed to open %s\n", filename); > goto error_free_filename; > @@ -235,13 +235,13 @@ int iioutils_get_param_float(float *output, const char > *param_name, > } > > 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(, > @@ -325,12 +325,12 @@ int build_channel_array(const char *device_dir, > 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(, > @@ -341,7 +341,7 @@ int build_channel_array(const char *device_dir, > } > > sysfsfp = fopen(filename, "r"); > - if (sysfsfp == NULL) { > + if (!sysfsfp) { > ret = -errno; > free(filename); > goto error_close_dir; > @@ -369,13 +369,13 @@ int build_channel_array(const char *device_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; > @@ -391,7 +391,7 @@ int build_channel_array(const char *device_dir, > } > > sysfsfp = fopen(filename, "r"); > - if (sysfsfp == NULL) { > + if (!sysfsfp) { > ret = -errno; > free(filename); > count--; > @@ -424,7 +424,7 @@ int build_channel_array(const char *device_dir, >
[PATCH 1/3] tools: iio: Remove explicit NULL comparison
Remove explicit NULL comparison and write it in its simpler form as recommended by checkpatch.pl. Signed-off-by: Cristina Opriceana --- tools/iio/generic_buffer.c | 4 ++-- tools/iio/iio_utils.c | 56 +++--- tools/iio/lsiio.c | 10 - 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index 0e73723..9535c2d 100644 --- a/tools/iio/generic_buffer.c +++ b/tools/iio/generic_buffer.c @@ -270,7 +270,7 @@ int main(int argc, char **argv) } } - if (device_name == NULL) { + if (!device_name) { printf("Device name not set\n"); print_usage(); return -1; @@ -290,7 +290,7 @@ int main(int argc, char **argv) return -ENOMEM; if (!notrigger) { - if (trigger_name == NULL) { + if (!trigger_name) { /* * Build the trigger name. If it is device associated * its name is _dev[n] where n matches diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 8fb3214..4a7e480 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -117,13 +117,13 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, } 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? @@ -138,7 +138,7 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, } sysfsfp = fopen(filename, "r"); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; printf("failed to open %s\n", filename); goto error_free_filename; @@ -235,13 +235,13 @@ int iioutils_get_param_float(float *output, const char *param_name, } 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(, @@ -325,12 +325,12 @@ int build_channel_array(const char *device_dir, 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(, @@ -341,7 +341,7 @@ int build_channel_array(const char *device_dir, } sysfsfp = fopen(filename, "r"); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; free(filename); goto error_close_dir; @@ -369,13 +369,13 @@ int build_channel_array(const char *device_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; @@ -391,7 +391,7 @@ int build_channel_array(const char *device_dir, } sysfsfp = fopen(filename, "r"); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; free(filename); count--; @@ -424,7 +424,7 @@ int build_channel_array(const char *device_dir, current->name = strndup(ent->d_name, strlen(ent->d_name) - strlen("_en")); - if (current->name == NULL) { + if
[PATCH 1/3] tools: iio: Remove explicit NULL comparison
Remove explicit NULL comparison and write it in its simpler form as recommended by checkpatch.pl. Signed-off-by: Cristina Opriceana cristina.oprice...@gmail.com --- tools/iio/generic_buffer.c | 4 ++-- tools/iio/iio_utils.c | 56 +++--- tools/iio/lsiio.c | 10 - 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index 0e73723..9535c2d 100644 --- a/tools/iio/generic_buffer.c +++ b/tools/iio/generic_buffer.c @@ -270,7 +270,7 @@ int main(int argc, char **argv) } } - if (device_name == NULL) { + if (!device_name) { printf(Device name not set\n); print_usage(); return -1; @@ -290,7 +290,7 @@ int main(int argc, char **argv) return -ENOMEM; if (!notrigger) { - if (trigger_name == NULL) { + if (!trigger_name) { /* * Build the trigger name. If it is device associated * its name is device_name_dev[n] where n matches diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 8fb3214..4a7e480 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -117,13 +117,13 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, } 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? @@ -138,7 +138,7 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, } sysfsfp = fopen(filename, r); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; printf(failed to open %s\n, filename); goto error_free_filename; @@ -235,13 +235,13 @@ int iioutils_get_param_float(float *output, const char *param_name, } 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, @@ -325,12 +325,12 @@ int build_channel_array(const char *device_dir, 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, @@ -341,7 +341,7 @@ int build_channel_array(const char *device_dir, } sysfsfp = fopen(filename, r); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; free(filename); goto error_close_dir; @@ -369,13 +369,13 @@ int build_channel_array(const char *device_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; @@ -391,7 +391,7 @@ int build_channel_array(const char *device_dir, } sysfsfp = fopen(filename, r); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; free(filename); count--; @@ -424,7 +424,7 @@ int build_channel_array(const char *device_dir, current-name = strndup(ent-d_name, strlen(ent-d_name) - strlen(_en)); - if (current-name == NULL) { +
Re: [PATCH 1/3] tools: iio: Remove explicit NULL comparison
Cristina Opriceana schrieb am 13.07.2015 um 15:15: Remove explicit NULL comparison and write it in its simpler form as recommended by checkpatch.pl. Signed-off-by: Cristina Opriceana cristina.oprice...@gmail.com Reviewed-by: Hartmut Knaack knaac...@gmx.de --- Every instance covered, consistency improved. Not everyone will mind that, but good job. tools/iio/generic_buffer.c | 4 ++-- tools/iio/iio_utils.c | 56 +++--- tools/iio/lsiio.c | 10 - 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index 0e73723..9535c2d 100644 --- a/tools/iio/generic_buffer.c +++ b/tools/iio/generic_buffer.c @@ -270,7 +270,7 @@ int main(int argc, char **argv) } } - if (device_name == NULL) { + if (!device_name) { printf(Device name not set\n); print_usage(); return -1; @@ -290,7 +290,7 @@ int main(int argc, char **argv) return -ENOMEM; if (!notrigger) { - if (trigger_name == NULL) { + if (!trigger_name) { /* * Build the trigger name. If it is device associated * its name is device_name_dev[n] where n matches diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 8fb3214..4a7e480 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -117,13 +117,13 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, } 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? @@ -138,7 +138,7 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, } sysfsfp = fopen(filename, r); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; printf(failed to open %s\n, filename); goto error_free_filename; @@ -235,13 +235,13 @@ int iioutils_get_param_float(float *output, const char *param_name, } 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, @@ -325,12 +325,12 @@ int build_channel_array(const char *device_dir, 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, @@ -341,7 +341,7 @@ int build_channel_array(const char *device_dir, } sysfsfp = fopen(filename, r); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; free(filename); goto error_close_dir; @@ -369,13 +369,13 @@ int build_channel_array(const char *device_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; @@ -391,7 +391,7 @@ int build_channel_array(const char *device_dir, } sysfsfp = fopen(filename, r); - if (sysfsfp == NULL) { + if (!sysfsfp) { ret = -errno; free(filename); count--; @@ -424,7 +424,7 @@ int build_channel_array(const char *device_dir, current-name = strndup(ent-d_name,