Commit afce6996 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Borislav Petkov

EDAC/aspeed: Fix handling of platform_get_irq() error

platform_get_irq() returns a negative error number on error. In such a
case, comparison to 0 would pass the check therefore check the return
value properly, whether it is negative.

 [ bp: Massage commit message. ]

Fixes: 9b7e6242 ("EDAC, aspeed: Add an Aspeed AST2500 EDAC driver")
Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarStefan Schaeckeler <schaecsn@gmx.net>
Link: https://lkml.kernel.org/r/20200827070743.26628-1-krzk@kernel.org
parent 857a3139
...@@ -209,8 +209,8 @@ static int config_irq(void *ctx, struct platform_device *pdev) ...@@ -209,8 +209,8 @@ static int config_irq(void *ctx, struct platform_device *pdev)
/* register interrupt handler */ /* register interrupt handler */
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
dev_dbg(&pdev->dev, "got irq %d\n", irq); dev_dbg(&pdev->dev, "got irq %d\n", irq);
if (!irq) if (irq < 0)
return -ENODEV; return irq;
rc = devm_request_irq(&pdev->dev, irq, mcr_isr, IRQF_TRIGGER_HIGH, rc = devm_request_irq(&pdev->dev, irq, mcr_isr, IRQF_TRIGGER_HIGH,
DRV_NAME, ctx); DRV_NAME, ctx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment