diff mbox series

[1/2] EDAC/aspeed: Fix handling of platform_get_irq() error

Message ID 20200827070743.26628-1-krzk@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/2] EDAC/aspeed: Fix handling of platform_get_irq() error | expand

Commit Message

Krzysztof Kozlowski Aug. 27, 2020, 7:07 a.m. UTC
platform_get_irq() returns -ERRNO on error.  In such case comparison
to 0 would pass the check.

Fixes: 9b7e6242ee4e ("EDAC, aspeed: Add an Aspeed AST2500 EDAC driver")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/edac/aspeed_edac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stefan Schaeckeler Aug. 27, 2020, 11:49 p.m. UTC | #1
>  platform_get_irq() returns -ERRNO on error.  In such case comparison
>  to 0 would pass the check.
>
>  Fixes: 9b7e6242ee4e ("EDAC, aspeed: Add an Aspeed AST2500 EDAC driver")
>  Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

Reviewed-by: Stefan Schaeckeler <schaecsn@gmx.net>

>  ---
>  drivers/edac/aspeed_edac.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
>  diff --git a/drivers/edac/aspeed_edac.c b/drivers/edac/aspeed_edac.c
>  index b194658b8b5c..fbec28dc661d 100644
>  --- a/drivers/edac/aspeed_edac.c
>  +++ b/drivers/edac/aspeed_edac.c
>  @@ -209,8 +209,8 @@ static int config_irq(void *ctx, struct platform_device *pdev)
>   	/* register interrupt handler */
>   	irq = platform_get_irq(pdev, 0);
>   	dev_dbg(&pdev->dev, "got irq %d\n", irq);
>  -	if (!irq)
>  -		return -ENODEV;
>  +	if (irq < 0)
>  +		return irq;
>
>   	rc = devm_request_irq(&pdev->dev, irq, mcr_isr, IRQF_TRIGGER_HIGH,
>   			      DRV_NAME, ctx);
>  --
>  2.17.1
>
>
Borislav Petkov Sept. 1, 2020, 6:51 p.m. UTC | #2
On Thu, Aug 27, 2020 at 09:07:42AM +0200, Krzysztof Kozlowski wrote:
> platform_get_irq() returns -ERRNO on error.  In such case comparison
> to 0 would pass the check.
> 
> Fixes: 9b7e6242ee4e ("EDAC, aspeed: Add an Aspeed AST2500 EDAC driver")
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  drivers/edac/aspeed_edac.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Both applied,
thanks.
diff mbox series

Patch

diff --git a/drivers/edac/aspeed_edac.c b/drivers/edac/aspeed_edac.c
index b194658b8b5c..fbec28dc661d 100644
--- a/drivers/edac/aspeed_edac.c
+++ b/drivers/edac/aspeed_edac.c
@@ -209,8 +209,8 @@  static int config_irq(void *ctx, struct platform_device *pdev)
 	/* register interrupt handler */
 	irq = platform_get_irq(pdev, 0);
 	dev_dbg(&pdev->dev, "got irq %d\n", irq);
-	if (!irq)
-		return -ENODEV;
+	if (irq < 0)
+		return irq;
 
 	rc = devm_request_irq(&pdev->dev, irq, mcr_isr, IRQF_TRIGGER_HIGH,
 			      DRV_NAME, ctx);