diff mbox series

lib: fwts_acpi_tables: remove redundant initialization of ret

Message ID 20190610115712.29702-1-colin.king@canonical.com
State Accepted
Headers show
Series lib: fwts_acpi_tables: remove redundant initialization of ret | expand

Commit Message

Colin Ian King June 10, 2019, 11:57 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The variable ret is being initialized however that value is never
read because ret is being re-assigned on various code paths that
follow it.  Hence the initialization is redundant and can be removed.
Also add a { } braces to clean up code style.

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

Comments

Alex Hung June 10, 2019, 8:30 p.m. UTC | #1
On 2019-06-10 4:57 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable ret is being initialized however that value is never
> read because ret is being re-assigned on various code paths that
> follow it.  Hence the initialization is redundant and can be removed.
> Also add a { } braces to clean up code style.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_acpi_tables.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index 88f484b7..a7144f76 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -1204,7 +1204,7 @@ static int fwts_acpi_load_tables_from_sysfs(fwts_framework *fw)
>   */
>  int fwts_acpi_load_tables(fwts_framework *fw)
>  {
> -	int ret = FWTS_ERROR;
> +	int ret;
>  	bool require_fixup = false;
>  
>  	if (fw->acpi_table_path != NULL) {
> @@ -1221,8 +1221,9 @@ int fwts_acpi_load_tables(fwts_framework *fw)
>  			ret = fwts_acpi_load_tables_from_sysfs(fw);
>  			require_fixup = true;
>  		}
> -	} else
> +	} else {
>  		ret = FWTS_ERROR_NO_PRIV;
> +	}
>  
>  	if (ret == FWTS_OK) {
>  		acpi_tables_loaded = ACPI_TABLES_LOADED_OK;
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu June 11, 2019, 5:46 a.m. UTC | #2
On 6/10/19 7:57 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The variable ret is being initialized however that value is never
> read because ret is being re-assigned on various code paths that
> follow it.  Hence the initialization is redundant and can be removed.
> Also add a { } braces to clean up code style.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_acpi_tables.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index 88f484b7..a7144f76 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -1204,7 +1204,7 @@ static int fwts_acpi_load_tables_from_sysfs(fwts_framework *fw)
>   */
>  int fwts_acpi_load_tables(fwts_framework *fw)
>  {
> -	int ret = FWTS_ERROR;
> +	int ret;
>  	bool require_fixup = false;
>  
>  	if (fw->acpi_table_path != NULL) {
> @@ -1221,8 +1221,9 @@ int fwts_acpi_load_tables(fwts_framework *fw)
>  			ret = fwts_acpi_load_tables_from_sysfs(fw);
>  			require_fixup = true;
>  		}
> -	} else
> +	} else {
>  		ret = FWTS_ERROR_NO_PRIV;
> +	}
>  
>  	if (ret == FWTS_OK) {
>  		acpi_tables_loaded = ACPI_TABLES_LOADED_OK;


Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox series

Patch

diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
index 88f484b7..a7144f76 100644
--- a/src/lib/src/fwts_acpi_tables.c
+++ b/src/lib/src/fwts_acpi_tables.c
@@ -1204,7 +1204,7 @@  static int fwts_acpi_load_tables_from_sysfs(fwts_framework *fw)
  */
 int fwts_acpi_load_tables(fwts_framework *fw)
 {
-	int ret = FWTS_ERROR;
+	int ret;
 	bool require_fixup = false;
 
 	if (fw->acpi_table_path != NULL) {
@@ -1221,8 +1221,9 @@  int fwts_acpi_load_tables(fwts_framework *fw)
 			ret = fwts_acpi_load_tables_from_sysfs(fw);
 			require_fixup = true;
 		}
-	} else
+	} else {
 		ret = FWTS_ERROR_NO_PRIV;
+	}
 
 	if (ret == FWTS_OK) {
 		acpi_tables_loaded = ACPI_TABLES_LOADED_OK;