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

EDAC/ti: 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: 86a18ee21e5e ("EDAC, ti: Add support for TI keystone and DRA7xx EDAC")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Tero Kristo <t-kristo@ti.com>
Link: https://lkml.kernel.org/r/20200827070743.26628-2-krzk@kernel.org

authored by

Krzysztof Kozlowski and committed by
Borislav Petkov
66077adb afce6996

+2 -1
+2 -1
drivers/edac/ti_edac.c
··· 278 278 279 279 /* add EMIF ECC error handler */ 280 280 error_irq = platform_get_irq(pdev, 0); 281 - if (!error_irq) { 281 + if (error_irq < 0) { 282 + ret = error_irq; 282 283 edac_printk(KERN_ERR, EDAC_MOD_NAME, 283 284 "EMIF irq number not defined.\n"); 284 285 goto err;