Patchwork apci: apicinstance: clean up smatch warning

login
register
mail settings
Submitter Colin King
Date Jan. 16, 2013, 1:01 a.m.
Message ID <1358298076-7523-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/212362/
State Accepted
Headers show

Comments

Colin King - Jan. 16, 2013, 1:01 a.m.
From: Colin Ian King <colin.king@canonical.com>

smatch gets confused by the use of count to check if the madt table
has been set and the code is a little bit clearer if we just check
to see if the table is not set by checking if it is NULL.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/apicinstance/apicinstance.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Keng-Yu Lin - Jan. 29, 2013, 6:32 a.m.
On Wed, Jan 16, 2013 at 9:01 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> smatch gets confused by the use of count to check if the madt table
> has been set and the code is a little bit clearer if we just check
> to see if the table is not set by checking if it is NULL.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/apicinstance/apicinstance.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/acpi/apicinstance/apicinstance.c b/src/acpi/apicinstance/apicinstance.c
> index 245aa48..d2376de 100644
> --- a/src/acpi/apicinstance/apicinstance.c
> +++ b/src/acpi/apicinstance/apicinstance.c
> @@ -43,7 +43,7 @@ static int apicinstance_test1(fwts_framework *fw)
>                                 table->name,
>                                 (unsigned long long)table->addr,
>                                 (int)table->length);
> -                       if (count == 0)
> +                       if (first_madt_table == NULL)
>                                 first_madt_table = table;
>                         else {
>                                 if ((first_madt_table->length == table->length) &&
> --
> 1.8.0
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung - Jan. 31, 2013, 7:30 a.m.
On 01/16/2013 09:01 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> smatch gets confused by the use of count to check if the madt table
> has been set and the code is a little bit clearer if we just check
> to see if the table is not set by checking if it is NULL.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/apicinstance/apicinstance.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/acpi/apicinstance/apicinstance.c b/src/acpi/apicinstance/apicinstance.c
> index 245aa48..d2376de 100644
> --- a/src/acpi/apicinstance/apicinstance.c
> +++ b/src/acpi/apicinstance/apicinstance.c
> @@ -43,7 +43,7 @@ static int apicinstance_test1(fwts_framework *fw)
>   				table->name,
>   				(unsigned long long)table->addr,
>   				(int)table->length);
> -			if (count == 0)
> +			if (first_madt_table == NULL)
>   				first_madt_table = table;
>   			else {
>   				if ((first_madt_table->length == table->length) &&
>
Acked-by: Alex Hung <alex.hung@canonical.com>

Patch

diff --git a/src/acpi/apicinstance/apicinstance.c b/src/acpi/apicinstance/apicinstance.c
index 245aa48..d2376de 100644
--- a/src/acpi/apicinstance/apicinstance.c
+++ b/src/acpi/apicinstance/apicinstance.c
@@ -43,7 +43,7 @@  static int apicinstance_test1(fwts_framework *fw)
 				table->name,
 				(unsigned long long)table->addr,
 				(int)table->length);
-			if (count == 0)
+			if (first_madt_table == NULL)
 				first_madt_table = table;
 			else {
 				if ((first_madt_table->length == table->length) &&