diff mbox series

[V2] acpi: s3/s4: initialize error to zero

Message ID 20190704163515.12451-1-colin.king@canonical.com
State Accepted
Headers show
Series [V2] acpi: s3/s4: initialize error to zero | expand

Commit Message

Colin Ian King July 4, 2019, 4:35 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Static analysis is warning that error is not initialized; it is
actually set indirectly but lets be overly cautious and initialize
it anyhow to squish the static analysis warnings.

Addresses-Coverity: ("Unintialized scalar variable")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/s3/s3.c | 2 +-
 src/acpi/s4/s4.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Alex Hung July 4, 2019, 5:42 p.m. UTC | #1
On 2019-07-04 10:35 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Static analysis is warning that error is not initialized; it is
> actually set indirectly but lets be overly cautious and initialize
> it anyhow to squish the static analysis warnings.
> 
> Addresses-Coverity: ("Unintialized scalar variable")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/s3/s3.c | 2 +-
>  src/acpi/s4/s4.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
> index c754af81..3a57825a 100644
> --- a/src/acpi/s3/s3.c
> +++ b/src/acpi/s3/s3.c
> @@ -473,7 +473,7 @@ static int s3_check_log(
>  	int *suspend_too_long,
>  	int *resume_too_long)
>  {
> -	int error;
> +	int error = 0;
>  	int oops;
>  	int warn_on;
>  
> diff --git a/src/acpi/s4/s4.c b/src/acpi/s4/s4.c
> index 6de1dd91..34b6f7b5 100644
> --- a/src/acpi/s4/s4.c
> +++ b/src/acpi/s4/s4.c
> @@ -68,7 +68,7 @@ static int s4_init(fwts_framework *fw)
>  static void s4_check_log(fwts_framework *fw,
>  	fwts_list *klog, int *errors, int *oopses, int *warn_ons)
>  {
> -	int error;
> +	int error = 0;
>  	int oops;
>  	int warn_on;
>  
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu July 24, 2019, 6:43 a.m. UTC | #2
On 7/5/19 12:35 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Static analysis is warning that error is not initialized; it is
> actually set indirectly but lets be overly cautious and initialize
> it anyhow to squish the static analysis warnings.
> 
> Addresses-Coverity: ("Unintialized scalar variable")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/s3/s3.c | 2 +-
>   src/acpi/s4/s4.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
> index c754af81..3a57825a 100644
> --- a/src/acpi/s3/s3.c
> +++ b/src/acpi/s3/s3.c
> @@ -473,7 +473,7 @@ static int s3_check_log(
>   	int *suspend_too_long,
>   	int *resume_too_long)
>   {
> -	int error;
> +	int error = 0;
>   	int oops;
>   	int warn_on;
>   
> diff --git a/src/acpi/s4/s4.c b/src/acpi/s4/s4.c
> index 6de1dd91..34b6f7b5 100644
> --- a/src/acpi/s4/s4.c
> +++ b/src/acpi/s4/s4.c
> @@ -68,7 +68,7 @@ static int s4_init(fwts_framework *fw)
>   static void s4_check_log(fwts_framework *fw,
>   	fwts_list *klog, int *errors, int *oopses, int *warn_ons)
>   {
> -	int error;
> +	int error = 0;
>   	int oops;
>   	int warn_on;
>   
> 

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

Patch

diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
index c754af81..3a57825a 100644
--- a/src/acpi/s3/s3.c
+++ b/src/acpi/s3/s3.c
@@ -473,7 +473,7 @@  static int s3_check_log(
 	int *suspend_too_long,
 	int *resume_too_long)
 {
-	int error;
+	int error = 0;
 	int oops;
 	int warn_on;
 
diff --git a/src/acpi/s4/s4.c b/src/acpi/s4/s4.c
index 6de1dd91..34b6f7b5 100644
--- a/src/acpi/s4/s4.c
+++ b/src/acpi/s4/s4.c
@@ -68,7 +68,7 @@  static int s4_init(fwts_framework *fw)
 static void s4_check_log(fwts_framework *fw,
 	fwts_list *klog, int *errors, int *oopses, int *warn_ons)
 {
-	int error;
+	int error = 0;
 	int oops;
 	int warn_on;