diff mbox

lib: fwts_acpi_tables: remove dead assignment of facs

Message ID 20170523094757.6260-1-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King May 23, 2017, 9:47 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

facs is only required if the table does not exist and one
needs to be faked.  Remove the redundant dead assignment. Detected
by scan-build.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_acpi_tables.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Ivan Hu May 23, 2017, 10:06 a.m. UTC | #1
On 05/23/2017 05:47 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> facs is only required if the table does not exist and one
> needs to be faked.  Remove the redundant dead assignment. Detected
> by scan-build.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_acpi_tables.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index 1d4fc705..f7547c43 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -970,7 +970,6 @@ static int fwts_acpi_load_tables_fixup(fwts_framework *fw)
>   	fwts_acpi_table_info *table;
>   	fwts_acpi_table_rsdp *rsdp = NULL;
>   	fwts_acpi_table_fadt *fadt = NULL;
> -	fwts_acpi_table_facs *facs = NULL;
>   	uint64_t rsdt_fake_addr = 0, xsdt_fake_addr = 0;
>   	bool redo_rsdp_checksum = false;
>   
> @@ -992,11 +991,10 @@ static int fwts_acpi_load_tables_fixup(fwts_framework *fw)
>   		fwts_log_error(fw, "ACPI table find failure.");
>   		return FWTS_ERROR;
>   	}
> -	if (table) {
> -		facs = (fwts_acpi_table_facs *)table->data;
> -	} else {
> +	if (!table) {
>   		size_t size = 64;
>   		uint64_t facs_addr;
> +		fwts_acpi_table_facs *facs = NULL;
>   
>   		/* This is most unexpected, so warn about it */
>   		fwts_log_warning(fw, "No FACS found, fwts has faked one instead.");

Acked-by: Ivan Hu <ivan.hu@canonical.com>
Alex Hung May 23, 2017, 5:57 p.m. UTC | #2
On 2017-05-23 02:47 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> facs is only required if the table does not exist and one
> needs to be faked.  Remove the redundant dead assignment. Detected
> by scan-build.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_acpi_tables.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index 1d4fc705..f7547c43 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -970,7 +970,6 @@ static int fwts_acpi_load_tables_fixup(fwts_framework *fw)
>   	fwts_acpi_table_info *table;
>   	fwts_acpi_table_rsdp *rsdp = NULL;
>   	fwts_acpi_table_fadt *fadt = NULL;
> -	fwts_acpi_table_facs *facs = NULL;
>   	uint64_t rsdt_fake_addr = 0, xsdt_fake_addr = 0;
>   	bool redo_rsdp_checksum = false;
>   
> @@ -992,11 +991,10 @@ static int fwts_acpi_load_tables_fixup(fwts_framework *fw)
>   		fwts_log_error(fw, "ACPI table find failure.");
>   		return FWTS_ERROR;
>   	}
> -	if (table) {
> -		facs = (fwts_acpi_table_facs *)table->data;
> -	} else {
> +	if (!table) {
>   		size_t size = 64;
>   		uint64_t facs_addr;
> +		fwts_acpi_table_facs *facs = NULL;
>   
>   		/* This is most unexpected, so warn about it */
>   		fwts_log_warning(fw, "No FACS found, fwts has faked one instead.");
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
index 1d4fc705..f7547c43 100644
--- a/src/lib/src/fwts_acpi_tables.c
+++ b/src/lib/src/fwts_acpi_tables.c
@@ -970,7 +970,6 @@  static int fwts_acpi_load_tables_fixup(fwts_framework *fw)
 	fwts_acpi_table_info *table;
 	fwts_acpi_table_rsdp *rsdp = NULL;
 	fwts_acpi_table_fadt *fadt = NULL;
-	fwts_acpi_table_facs *facs = NULL;
 	uint64_t rsdt_fake_addr = 0, xsdt_fake_addr = 0;
 	bool redo_rsdp_checksum = false;
 
@@ -992,11 +991,10 @@  static int fwts_acpi_load_tables_fixup(fwts_framework *fw)
 		fwts_log_error(fw, "ACPI table find failure.");
 		return FWTS_ERROR;
 	}
-	if (table) {
-		facs = (fwts_acpi_table_facs *)table->data;
-	} else {
+	if (!table) {
 		size_t size = 64;
 		uint64_t facs_addr;
+		fwts_acpi_table_facs *facs = NULL;
 
 		/* This is most unexpected, so warn about it */
 		fwts_log_warning(fw, "No FACS found, fwts has faked one instead.");