Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] power: supply: cpcap-battery: Fix platform_get_irq_byname's error checking
@ 2017-11-24 17:01 Arvind Yadav
  2017-12-01 15:30 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Arvind Yadav @ 2017-11-24 17:01 UTC (permalink / raw)
  To: sre; +Cc: linux-kernel, linux-pm

The platform_get_irq_byname() function returns -1 if an error occurs.
zero or positive number on success. platform_get_irq_byname() error
checking for zero is not correct.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/power/supply/cpcap-battery.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c
index ee71a2b..98ba078 100644
--- a/drivers/power/supply/cpcap-battery.c
+++ b/drivers/power/supply/cpcap-battery.c
@@ -586,8 +586,8 @@ static int cpcap_battery_init_irq(struct platform_device *pdev,
 	int irq, error;
 
 	irq = platform_get_irq_byname(pdev, name);
-	if (!irq)
-		return -ENODEV;
+	if (irq < 0)
+		return irq;
 
 	error = devm_request_threaded_irq(ddata->dev, irq, NULL,
 					  cpcap_battery_irq_thread,
-- 
2.7.4

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

* Re: [PATCH] power: supply: cpcap-battery: Fix platform_get_irq_byname's error checking
  2017-11-24 17:01 [PATCH] power: supply: cpcap-battery: Fix platform_get_irq_byname's error checking Arvind Yadav
@ 2017-12-01 15:30 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2017-12-01 15:30 UTC (permalink / raw)
  To: Arvind Yadav; +Cc: linux-kernel, linux-pm

[-- Attachment #1: Type: text/plain, Size: 1039 bytes --]

Hi,

On Fri, Nov 24, 2017 at 10:31:40PM +0530, Arvind Yadav wrote:
> The platform_get_irq_byname() function returns -1 if an error occurs.
> zero or positive number on success. platform_get_irq_byname() error
> checking for zero is not correct.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/cpcap-battery.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c
> index ee71a2b..98ba078 100644
> --- a/drivers/power/supply/cpcap-battery.c
> +++ b/drivers/power/supply/cpcap-battery.c
> @@ -586,8 +586,8 @@ static int cpcap_battery_init_irq(struct platform_device *pdev,
>  	int irq, error;
>  
>  	irq = platform_get_irq_byname(pdev, name);
> -	if (!irq)
> -		return -ENODEV;
> +	if (irq < 0)
> +		return irq;
>  
>  	error = devm_request_threaded_irq(ddata->dev, irq, NULL,
>  					  cpcap_battery_irq_thread,
> -- 
> 2.7.4
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2017-12-01 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-24 17:01 [PATCH] power: supply: cpcap-battery: Fix platform_get_irq_byname's error checking Arvind Yadav
2017-12-01 15:30 ` Sebastian Reichel

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