EDAC/ti: Fix handling of platform_get_irq() error
authorKrzysztof Kozlowski <krzk@kernel.org>
Thu, 27 Aug 2020 07:07:43 +0000 (09:07 +0200)
committerBorislav Petkov <bp@suse.de>
Tue, 1 Sep 2020 18:43:20 +0000 (20:43 +0200)
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
drivers/edac/ti_edac.c

index 6e52796a0b41470aa3b496cc6d0e295eb20ff9ba..e7eae20f83d1d03875bb3ef30b3d7eae2c201272 100644 (file)
@@ -278,7 +278,8 @@ static int ti_edac_probe(struct platform_device *pdev)
 
        /* add EMIF ECC error handler */
        error_irq = platform_get_irq(pdev, 0);
-       if (!error_irq) {
+       if (error_irq < 0) {
+               ret = error_irq;
                edac_printk(KERN_ERR, EDAC_MOD_NAME,
                            "EMIF irq number not defined.\n");
                goto err;