diff mbox

[1/3] acpi: mpst: remove redundant assigments to passed on errors

Message ID 20170228190243.32225-2-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Feb. 28, 2017, 7:02 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

There are several occurrances where passed is set to false and
the error exit path via the error label is a direct return hence
the setting of passed is redundant and can be removed.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/mpst/mpst.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Alex Hung March 1, 2017, 3:07 a.m. UTC | #1
On 2017-03-01 03:02 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> There are several occurrances where passed is set to false and
> the error exit path via the error label is a direct return hence
> the setting of passed is redundant and can be removed.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/mpst/mpst.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/src/acpi/mpst/mpst.c b/src/acpi/mpst/mpst.c
> index b817687..db20df7 100644
> --- a/src/acpi/mpst/mpst.c
> +++ b/src/acpi/mpst/mpst.c
> @@ -79,7 +79,6 @@ static int mpst_test1(fwts_framework *fw)
>
>  	node_offset = sizeof(fwts_acpi_table_mpst) + (sizeof(fwts_acpi_table_mpst_power_node_list));
>  	if (mpst->header.length < node_offset + sizeof(fwts_acpi_table_mpst_power_node) * node_list->count) {
> -		passed = false;
>  		fwts_failed(fw, LOG_LEVEL_HIGH,
>  			"MPSTOutOfBound",
>  			"MPST's table length is too small to contain all sub-tables");
> @@ -130,7 +129,6 @@ static int mpst_test1(fwts_framework *fw)
>
>  		node_offset += sizeof(fwts_acpi_table_mpst_power_node);
>  		if (mpst->header.length < node_offset + sizeof(fwts_acpi_table_mpst_power_state) * power_node->num_states) {
> -			passed = false;
>  			fwts_failed(fw, LOG_LEVEL_HIGH,
>  				"MPSTOutOfBound",
>  				"MPST's table length is too small to contain all sub-tables");
> @@ -145,7 +143,6 @@ static int mpst_test1(fwts_framework *fw)
>  		}
>
>  		if (mpst->header.length < node_offset + sizeof(fwts_acpi_table_mpst_component) * power_node->num_components) {
> -			passed = false;
>  			fwts_failed(fw, LOG_LEVEL_HIGH,
>  				"MPSTOutOfBound",
>  				"MPST's table length is too small to contain all sub-tables");
> @@ -173,7 +170,6 @@ static int mpst_test1(fwts_framework *fw)
>
>  	node_offset += sizeof(fwts_acpi_table_mpst_power_char_list);
>  	if (mpst->header.length < node_offset + sizeof(fwts_acpi_table_mpst_power_char) * char_list->count) {
> -		passed = false;
>  		fwts_failed(fw, LOG_LEVEL_HIGH,
>  			"MPSTOutOfBound",
>  			"MPST's table length is too small to contain all sub-tables");
>

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu March 2, 2017, 6:50 a.m. UTC | #2
On 03/01/2017 03:02 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> There are several occurrances where passed is set to false and
> the error exit path via the error label is a direct return hence
> the setting of passed is redundant and can be removed.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/mpst/mpst.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/src/acpi/mpst/mpst.c b/src/acpi/mpst/mpst.c
> index b817687..db20df7 100644
> --- a/src/acpi/mpst/mpst.c
> +++ b/src/acpi/mpst/mpst.c
> @@ -79,7 +79,6 @@ static int mpst_test1(fwts_framework *fw)
>
>  	node_offset = sizeof(fwts_acpi_table_mpst) + (sizeof(fwts_acpi_table_mpst_power_node_list));
>  	if (mpst->header.length < node_offset + sizeof(fwts_acpi_table_mpst_power_node) * node_list->count) {
> -		passed = false;
>  		fwts_failed(fw, LOG_LEVEL_HIGH,
>  			"MPSTOutOfBound",
>  			"MPST's table length is too small to contain all sub-tables");
> @@ -130,7 +129,6 @@ static int mpst_test1(fwts_framework *fw)
>
>  		node_offset += sizeof(fwts_acpi_table_mpst_power_node);
>  		if (mpst->header.length < node_offset + sizeof(fwts_acpi_table_mpst_power_state) * power_node->num_states) {
> -			passed = false;
>  			fwts_failed(fw, LOG_LEVEL_HIGH,
>  				"MPSTOutOfBound",
>  				"MPST's table length is too small to contain all sub-tables");
> @@ -145,7 +143,6 @@ static int mpst_test1(fwts_framework *fw)
>  		}
>
>  		if (mpst->header.length < node_offset + sizeof(fwts_acpi_table_mpst_component) * power_node->num_components) {
> -			passed = false;
>  			fwts_failed(fw, LOG_LEVEL_HIGH,
>  				"MPSTOutOfBound",
>  				"MPST's table length is too small to contain all sub-tables");
> @@ -173,7 +170,6 @@ static int mpst_test1(fwts_framework *fw)
>
>  	node_offset += sizeof(fwts_acpi_table_mpst_power_char_list);
>  	if (mpst->header.length < node_offset + sizeof(fwts_acpi_table_mpst_power_char) * char_list->count) {
> -		passed = false;
>  		fwts_failed(fw, LOG_LEVEL_HIGH,
>  			"MPSTOutOfBound",
>  			"MPST's table length is too small to contain all sub-tables");
>


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

Patch

diff --git a/src/acpi/mpst/mpst.c b/src/acpi/mpst/mpst.c
index b817687..db20df7 100644
--- a/src/acpi/mpst/mpst.c
+++ b/src/acpi/mpst/mpst.c
@@ -79,7 +79,6 @@  static int mpst_test1(fwts_framework *fw)
 
 	node_offset = sizeof(fwts_acpi_table_mpst) + (sizeof(fwts_acpi_table_mpst_power_node_list));
 	if (mpst->header.length < node_offset + sizeof(fwts_acpi_table_mpst_power_node) * node_list->count) {
-		passed = false;
 		fwts_failed(fw, LOG_LEVEL_HIGH,
 			"MPSTOutOfBound",
 			"MPST's table length is too small to contain all sub-tables");
@@ -130,7 +129,6 @@  static int mpst_test1(fwts_framework *fw)
 
 		node_offset += sizeof(fwts_acpi_table_mpst_power_node);
 		if (mpst->header.length < node_offset + sizeof(fwts_acpi_table_mpst_power_state) * power_node->num_states) {
-			passed = false;
 			fwts_failed(fw, LOG_LEVEL_HIGH,
 				"MPSTOutOfBound",
 				"MPST's table length is too small to contain all sub-tables");
@@ -145,7 +143,6 @@  static int mpst_test1(fwts_framework *fw)
 		}
 
 		if (mpst->header.length < node_offset + sizeof(fwts_acpi_table_mpst_component) * power_node->num_components) {
-			passed = false;
 			fwts_failed(fw, LOG_LEVEL_HIGH,
 				"MPSTOutOfBound",
 				"MPST's table length is too small to contain all sub-tables");
@@ -173,7 +170,6 @@  static int mpst_test1(fwts_framework *fw)
 
 	node_offset += sizeof(fwts_acpi_table_mpst_power_char_list);
 	if (mpst->header.length < node_offset + sizeof(fwts_acpi_table_mpst_power_char) * char_list->count) {
-		passed = false;
 		fwts_failed(fw, LOG_LEVEL_HIGH,
 			"MPSTOutOfBound",
 			"MPST's table length is too small to contain all sub-tables");