Message ID | 20210922101226.176760-1-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | acpi: cstates: remove redundant null check on entry | expand |
On 2021-09-22 4:12 a.m., Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > The pointer check on entry is redundant as this is already checked > in the while loop condition above. Clean up code by removing it. > > Cleans up cppcheck style warning. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpi/cstates/cstates.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/acpi/cstates/cstates.c b/src/acpi/cstates/cstates.c > index 45073c15..1fd65f9e 100644 > --- a/src/acpi/cstates/cstates.c > +++ b/src/acpi/cstates/cstates.c > @@ -66,7 +66,7 @@ static void get_cstates(char *path, fwts_cstates *state) > return; > > while ((entry = readdir(dir)) != NULL) { > - if (entry && strlen(entry->d_name)>3) { > + if (strlen(entry->d_name) > 3) { > long int nr; > int count; > > Acked-by: Alex Hung <alex.hung@canonical.com>
On 9/22/21 6:12 PM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > The pointer check on entry is redundant as this is already checked > in the while loop condition above. Clean up code by removing it. > > Cleans up cppcheck style warning. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpi/cstates/cstates.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/acpi/cstates/cstates.c b/src/acpi/cstates/cstates.c > index 45073c15..1fd65f9e 100644 > --- a/src/acpi/cstates/cstates.c > +++ b/src/acpi/cstates/cstates.c > @@ -66,7 +66,7 @@ static void get_cstates(char *path, fwts_cstates *state) > return; > > while ((entry = readdir(dir)) != NULL) { > - if (entry && strlen(entry->d_name)>3) { > + if (strlen(entry->d_name) > 3) { > long int nr; > int count; > > Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/acpi/cstates/cstates.c b/src/acpi/cstates/cstates.c index 45073c15..1fd65f9e 100644 --- a/src/acpi/cstates/cstates.c +++ b/src/acpi/cstates/cstates.c @@ -66,7 +66,7 @@ static void get_cstates(char *path, fwts_cstates *state) return; while ((entry = readdir(dir)) != NULL) { - if (entry && strlen(entry->d_name)>3) { + if (strlen(entry->d_name) > 3) { long int nr; int count;