Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 9b7e6242ee4e ("EDAC, aspeed: Add an Aspeed AST2500 EDAC driver")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Stefan Schaeckeler <schaecsn@gmx.net>
Link: https://lkml.kernel.org/r/20200827070743.26628-1-krzk@kernel.org

authored by

Krzysztof Kozlowski and committed by
Borislav Petkov
afce6996 857a3139

+2 -2
+2 -2
drivers/edac/aspeed_edac.c
··· 209 209 /* register interrupt handler */ 210 210 irq = platform_get_irq(pdev, 0); 211 211 dev_dbg(&pdev->dev, "got irq %d\n", irq); 212 - if (!irq) 213 - return -ENODEV; 212 + if (irq < 0) 213 + return irq; 214 214 215 215 rc = devm_request_irq(&pdev->dev, irq, mcr_isr, IRQF_TRIGGER_HIGH, 216 216 DRV_NAME, ctx);