diff mbox series

[-next] power: supply: 88pm860x_battery: fix the return value handle for platform_get_irq()

Message ID 20230731113959.1957820-1-ruanjinjie@huawei.com (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series [-next] power: supply: 88pm860x_battery: fix the return value handle for platform_get_irq() | expand

Commit Message

Jinjie Ruan July 31, 2023, 11:39 a.m. UTC
There is no possible for platform_get_irq() to return 0,
and the return value of platform_get_irq() is more sensible
to show the error reason.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
---
 drivers/power/supply/88pm860x_battery.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Jinjie Ruan Aug. 4, 2023, 1:18 a.m. UTC | #1
Ping.

On 2023/7/31 19:39, Ruan Jinjie wrote:
> There is no possible for platform_get_irq() to return 0,
> and the return value of platform_get_irq() is more sensible
> to show the error reason.
> 
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> ---
>  drivers/power/supply/88pm860x_battery.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/power/supply/88pm860x_battery.c b/drivers/power/supply/88pm860x_battery.c
> index f3f3f8cd1a7f..34619c4d4ece 100644
> --- a/drivers/power/supply/88pm860x_battery.c
> +++ b/drivers/power/supply/88pm860x_battery.c
> @@ -921,12 +921,12 @@ static int pm860x_battery_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	info->irq_cc = platform_get_irq(pdev, 0);
> -	if (info->irq_cc <= 0)
> -		return -EINVAL;
> +	if (info->irq_cc < 0)
> +		return info->irq_cc;
>  
>  	info->irq_batt = platform_get_irq(pdev, 1);
> -	if (info->irq_batt <= 0)
> -		return -EINVAL;
> +	if (info->irq_batt < 0)
> +		return info->irq_batt;
>  
>  	info->chip = chip;
>  	info->i2c =
Sebastian Reichel Sept. 12, 2023, 6:47 p.m. UTC | #2
On Mon, 31 Jul 2023 19:39:59 +0800, Ruan Jinjie wrote:
> There is no possible for platform_get_irq() to return 0,
> and the return value of platform_get_irq() is more sensible
> to show the error reason.
> 
> 

Applied, thanks!

[1/1] power: supply: 88pm860x_battery: fix the return value handle for platform_get_irq()
      commit: 6eca10a1c2e5c5edaf92d5a9d1bcf415456369b7

Best regards,
diff mbox series

Patch

diff --git a/drivers/power/supply/88pm860x_battery.c b/drivers/power/supply/88pm860x_battery.c
index f3f3f8cd1a7f..34619c4d4ece 100644
--- a/drivers/power/supply/88pm860x_battery.c
+++ b/drivers/power/supply/88pm860x_battery.c
@@ -921,12 +921,12 @@  static int pm860x_battery_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	info->irq_cc = platform_get_irq(pdev, 0);
-	if (info->irq_cc <= 0)
-		return -EINVAL;
+	if (info->irq_cc < 0)
+		return info->irq_cc;
 
 	info->irq_batt = platform_get_irq(pdev, 1);
-	if (info->irq_batt <= 0)
-		return -EINVAL;
+	if (info->irq_batt < 0)
+		return info->irq_batt;
 
 	info->chip = chip;
 	info->i2c =