Patchwork acpi: battery: Fix nesting bug

login
register
mail settings
Submitter Colin King
Date May 7, 2013, 8:10 a.m.
Message ID <1367914203-16327-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/242069/
State Accepted
Headers show

Comments

Colin King - May 7, 2013, 8:10 a.m.
From: Colin Ian King <colin.king@canonical.com>

Coverity CID #997282: Nesting level does not match indentation.

Nest correctly.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/battery/battery.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Alex Hung - May 8, 2013, 2:18 a.m.
On 05/07/2013 04:10 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Coverity CID #997282: Nesting level does not match indentation.
>
> Nest correctly.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/battery/battery.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/acpi/battery/battery.c b/src/acpi/battery/battery.c
> index f83f086..8f58491 100644
> --- a/src/acpi/battery/battery.c
> +++ b/src/acpi/battery/battery.c
> @@ -114,7 +114,7 @@ static int wait_for_acpi_event(fwts_framework *fw, char *name)
>   	if (events == 0)
>   		fwts_failed(fw, LOG_LEVEL_HIGH, "BatteryNoEvents",
>   			"Did not detect any ACPI battery events.");
> -	else
> +	else {
>   		fwts_passed(fw, "Detected ACPI battery events.");
>   		if (matching == 0)
>   			fwts_failed(fw, LOG_LEVEL_HIGH, "BatteryNoEvents",
> @@ -122,6 +122,7 @@ static int wait_for_acpi_event(fwts_framework *fw, char *name)
>   		else
>   			fwts_passed(fw, "Detected ACPI event for battery %s.",
>   				name);
> +	}
>
>   	return FWTS_OK;
>   }
>
Acked-by: Alex Hung <alex.hung@canonical.com>
Keng-Yu Lin - May 20, 2013, 7:32 a.m.
On Tue, May 7, 2013 at 4:10 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Coverity CID #997282: Nesting level does not match indentation.
>
> Nest correctly.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/battery/battery.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/acpi/battery/battery.c b/src/acpi/battery/battery.c
> index f83f086..8f58491 100644
> --- a/src/acpi/battery/battery.c
> +++ b/src/acpi/battery/battery.c
> @@ -114,7 +114,7 @@ static int wait_for_acpi_event(fwts_framework *fw, char *name)
>         if (events == 0)
>                 fwts_failed(fw, LOG_LEVEL_HIGH, "BatteryNoEvents",
>                         "Did not detect any ACPI battery events.");
> -       else
> +       else {
>                 fwts_passed(fw, "Detected ACPI battery events.");
>                 if (matching == 0)
>                         fwts_failed(fw, LOG_LEVEL_HIGH, "BatteryNoEvents",
> @@ -122,6 +122,7 @@ static int wait_for_acpi_event(fwts_framework *fw, char *name)
>                 else
>                         fwts_passed(fw, "Detected ACPI event for battery %s.",
>                                 name);
> +       }
>
>         return FWTS_OK;
>  }
> --
> 1.8.1.2
>

Acked-by: Keng-Yu Lin <kengyu@canonical.com>

Patch

diff --git a/src/acpi/battery/battery.c b/src/acpi/battery/battery.c
index f83f086..8f58491 100644
--- a/src/acpi/battery/battery.c
+++ b/src/acpi/battery/battery.c
@@ -114,7 +114,7 @@  static int wait_for_acpi_event(fwts_framework *fw, char *name)
 	if (events == 0)
 		fwts_failed(fw, LOG_LEVEL_HIGH, "BatteryNoEvents",
 			"Did not detect any ACPI battery events.");
-	else
+	else {
 		fwts_passed(fw, "Detected ACPI battery events.");
 		if (matching == 0)
 			fwts_failed(fw, LOG_LEVEL_HIGH, "BatteryNoEvents",
@@ -122,6 +122,7 @@  static int wait_for_acpi_event(fwts_framework *fw, char *name)
 		else
 			fwts_passed(fw, "Detected ACPI event for battery %s.",
 				name);
+	}
 
 	return FWTS_OK;
 }