[PATCH] acpi: ac_adapter: initialize matching and not_matching

Keng-Yu Lin kengyu at canonical.com
Mon May 20 07:20:43 UTC 2013


On Tue, May 7, 2013 at 8:51 AM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at 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 at 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 at canonical.com>



More information about the fwts-devel mailing list