public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] hp_accel: Silence an uninitialized variable warning
@ 2016-04-15 14:47 Dan Carpenter
  2016-04-15 15:29 ` Darren Hart
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-04-15 14:47 UTC (permalink / raw)
  To: Eric Piel; +Cc: Darren Hart, platform-driver-x86, linux-kernel, kernel-janitors

If acpi_evaluate_integer() fails then "lret" isn't initialized.  I've
tweaked the error handling to avoid this issue.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c
index 10ce6cb..746918e 100644
--- a/drivers/platform/x86/hp_accel.c
+++ b/drivers/platform/x86/hp_accel.c
@@ -127,8 +127,10 @@ static int lis3lv02d_acpi_read(struct lis3lv02d *lis3, int reg, u8 *ret)
 	arg0.integer.value = reg;
 
 	status = acpi_evaluate_integer(dev->handle, "ALRD", &args, &lret);
+	if (ACPI_FAILURE(status))
+		return -EINVAL;
 	*ret = lret;
-	return (status != AE_OK) ? -EINVAL : 0;
+	return 0;
 }
 
 /**

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] hp_accel: Silence an uninitialized variable warning
  2016-04-15 14:47 [patch] hp_accel: Silence an uninitialized variable warning Dan Carpenter
@ 2016-04-15 15:29 ` Darren Hart
  0 siblings, 0 replies; 2+ messages in thread
From: Darren Hart @ 2016-04-15 15:29 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Eric Piel, platform-driver-x86, linux-kernel, kernel-janitors

On Fri, Apr 15, 2016 at 05:47:20PM +0300, Dan Carpenter wrote:
> If acpi_evaluate_integer() fails then "lret" isn't initialized.  I've
> tweaked the error handling to avoid this issue.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks Dan, I verified and queued all 3 patches to fixes for 4.6.

> 
> diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c
> index 10ce6cb..746918e 100644
> --- a/drivers/platform/x86/hp_accel.c
> +++ b/drivers/platform/x86/hp_accel.c
> @@ -127,8 +127,10 @@ static int lis3lv02d_acpi_read(struct lis3lv02d *lis3, int reg, u8 *ret)
>  	arg0.integer.value = reg;
>  
>  	status = acpi_evaluate_integer(dev->handle, "ALRD", &args, &lret);
> +	if (ACPI_FAILURE(status))
> +		return -EINVAL;
>  	*ret = lret;
> -	return (status != AE_OK) ? -EINVAL : 0;
> +	return 0;
>  }
>  
>  /**
> 

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-15 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-15 14:47 [patch] hp_accel: Silence an uninitialized variable warning Dan Carpenter
2016-04-15 15:29 ` Darren Hart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox