kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/x86: intel_skl_int3472: Uninitialized variable in skl_int3472_handle_gpio_resources()
@ 2021-06-25 13:01 Dan Carpenter
  2021-06-25 13:46 ` Daniel Scally
  2021-06-28  9:10 ` Hans de Goede
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-06-25 13:01 UTC (permalink / raw)
  To: Daniel Scally
  Cc: Hans de Goede, Mark Gross, platform-driver-x86, kernel-janitors

This function returns negative error codes, zero (to indicate that
everything has been completed successfully) and one (to indicate that
more resources need to be handled still).

This code prints an uninitialized error message when the function
returns one which potentially leads to an Oops.

Fixes: 5de691bffe57 ("platform/x86: Add intel_skl_int3472 driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 .../platform/x86/intel/int3472/intel_skl_int3472_discrete.c   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c b/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c
index 17c6fe830765..9fe0a2527e1c 100644
--- a/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c
+++ b/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c
@@ -286,10 +286,10 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
 	int3472->ngpios++;
 	ACPI_FREE(obj);
 
-	if (ret)
+	if (ret < 0)
 		return dev_err_probe(int3472->dev, ret, err_msg);
 
-	return 0;
+	return ret;
 }
 
 static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472)
-- 
2.30.2


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

* Re: [PATCH] platform/x86: intel_skl_int3472: Uninitialized variable in skl_int3472_handle_gpio_resources()
  2021-06-25 13:01 [PATCH] platform/x86: intel_skl_int3472: Uninitialized variable in skl_int3472_handle_gpio_resources() Dan Carpenter
@ 2021-06-25 13:46 ` Daniel Scally
  2021-06-28  9:10 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Scally @ 2021-06-25 13:46 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Hans de Goede, Mark Gross, platform-driver-x86, kernel-janitors

Hi Dan, thanks for the patch

On 25/06/2021 14:01, Dan Carpenter wrote:
> This function returns negative error codes, zero (to indicate that
> everything has been completed successfully) and one (to indicate that
> more resources need to be handled still).
>
> This code prints an uninitialized error message when the function
> returns one which potentially leads to an Oops.


Ah! In the default case of the switch, took me a while to see that.
Thanks very much, good catch.


Reviewed-by: Daniel Scally <djrscally@gmail.com>

>
> Fixes: 5de691bffe57 ("platform/x86: Add intel_skl_int3472 driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  .../platform/x86/intel/int3472/intel_skl_int3472_discrete.c   | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c b/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c
> index 17c6fe830765..9fe0a2527e1c 100644
> --- a/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c
> +++ b/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c
> @@ -286,10 +286,10 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
>  	int3472->ngpios++;
>  	ACPI_FREE(obj);
>  
> -	if (ret)
> +	if (ret < 0)
>  		return dev_err_probe(int3472->dev, ret, err_msg);
>  
> -	return 0;
> +	return ret;
>  }
>  
>  static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472)

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

* Re: [PATCH] platform/x86: intel_skl_int3472: Uninitialized variable in skl_int3472_handle_gpio_resources()
  2021-06-25 13:01 [PATCH] platform/x86: intel_skl_int3472: Uninitialized variable in skl_int3472_handle_gpio_resources() Dan Carpenter
  2021-06-25 13:46 ` Daniel Scally
@ 2021-06-28  9:10 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2021-06-28  9:10 UTC (permalink / raw)
  To: Dan Carpenter, Daniel Scally
  Cc: Mark Gross, platform-driver-x86, kernel-janitors

Hi,

On 6/25/21 3:01 PM, Dan Carpenter wrote:
> This function returns negative error codes, zero (to indicate that
> everything has been completed successfully) and one (to indicate that
> more resources need to be handled still).
> 
> This code prints an uninitialized error message when the function
> returns one which potentially leads to an Oops.
> 
> Fixes: 5de691bffe57 ("platform/x86: Add intel_skl_int3472 driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans



> ---
>  .../platform/x86/intel/int3472/intel_skl_int3472_discrete.c   | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c b/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c
> index 17c6fe830765..9fe0a2527e1c 100644
> --- a/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c
> +++ b/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c
> @@ -286,10 +286,10 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
>  	int3472->ngpios++;
>  	ACPI_FREE(obj);
>  
> -	if (ret)
> +	if (ret < 0)
>  		return dev_err_probe(int3472->dev, ret, err_msg);
>  
> -	return 0;
> +	return ret;
>  }
>  
>  static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472)
> 


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

end of thread, other threads:[~2021-06-28  9:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 13:01 [PATCH] platform/x86: intel_skl_int3472: Uninitialized variable in skl_int3472_handle_gpio_resources() Dan Carpenter
2021-06-25 13:46 ` Daniel Scally
2021-06-28  9:10 ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).