diff mbox

acpi: ac_adapter: initialize matching and not_matching

Message ID 1367887919-25395-1-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King May 7, 2013, 12:51 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Coverity CID #997326, Unitialized scalar variable

We should intialize variables matching and not_matching to keep
coverity happy even though we don't actually need to check these
values - the call is just used to check if an AC adapter interface
is available for fwts to read.

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

Comments

Alex Hung May 10, 2013, 1:18 a.m. UTC | #1
On 05/07/2013 08:51 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Coverity CID #997326, Unitialized scalar variable
>
> We should intialize variables matching and not_matching to keep
> coverity happy even though we don't actually need to check these
> values - the call is just used to check if an AC adapter interface
> is available for fwts to read.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/ac_adapter/ac_adapter.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/acpi/ac_adapter/ac_adapter.c b/src/acpi/ac_adapter/ac_adapter.c
> index 28d0461..3fb97b5 100644
> --- a/src/acpi/ac_adapter/ac_adapter.c
> +++ b/src/acpi/ac_adapter/ac_adapter.c
> @@ -27,7 +27,8 @@
>
>   static int ac_adapter_init(fwts_framework *fw)
>   {
> -	int matching, not_matching;
> +	int matching = 0;
> +	int not_matching = 0;
>
>   	if (fwts_ac_adapter_get_state(FWTS_AC_ADAPTER_ANY, &matching, &not_matching) != FWTS_OK) {
>   		fwts_failed(fw, LOG_LEVEL_LOW, "NoACAdapterEntry",
>
Acked-by: Alex Hung <alex.hung@canonical.com>
Keng-Yu Lin May 20, 2013, 7:20 a.m. UTC | #2
On Tue, May 7, 2013 at 8:51 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Coverity CID #997326, Unitialized scalar variable
>
> We should intialize variables matching and not_matching to keep
> coverity happy even though we don't actually need to check these
> values - the call is just used to check if an AC adapter interface
> is available for fwts to read.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/ac_adapter/ac_adapter.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/acpi/ac_adapter/ac_adapter.c b/src/acpi/ac_adapter/ac_adapter.c
> index 28d0461..3fb97b5 100644
> --- a/src/acpi/ac_adapter/ac_adapter.c
> +++ b/src/acpi/ac_adapter/ac_adapter.c
> @@ -27,7 +27,8 @@
>
>  static int ac_adapter_init(fwts_framework *fw)
>  {
> -       int matching, not_matching;
> +       int matching = 0;
> +       int not_matching = 0;
>
>         if (fwts_ac_adapter_get_state(FWTS_AC_ADAPTER_ANY, &matching, &not_matching) != FWTS_OK) {
>                 fwts_failed(fw, LOG_LEVEL_LOW, "NoACAdapterEntry",
> --
> 1.8.1.2
>

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

Patch

diff --git a/src/acpi/ac_adapter/ac_adapter.c b/src/acpi/ac_adapter/ac_adapter.c
index 28d0461..3fb97b5 100644
--- a/src/acpi/ac_adapter/ac_adapter.c
+++ b/src/acpi/ac_adapter/ac_adapter.c
@@ -27,7 +27,8 @@ 
 
 static int ac_adapter_init(fwts_framework *fw)
 {
-	int matching, not_matching;
+	int matching = 0;
+	int not_matching = 0;
 
 	if (fwts_ac_adapter_get_state(FWTS_AC_ADAPTER_ANY, &matching, &not_matching) != FWTS_OK) {
 		fwts_failed(fw, LOG_LEVEL_LOW, "NoACAdapterEntry",