memory: fsl-corenet-cf: Fix handling of platform_get_irq() error
authorKrzysztof Kozlowski <krzk@kernel.org>
Thu, 27 Aug 2020 07:33:15 +0000 (09:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 08:05:40 +0000 (09:05 +0100)
[ Upstream commit dd85345abca60a8916617e8d75c0f9ce334336dd ]

platform_get_irq() returns -ERRNO on error.  In such case comparison
to 0 would pass the check.

Fixes: 54afbec0d57f ("memory: Freescale CoreNet Coherency Fabric error reporting driver")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20200827073315.29351-1-krzk@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/memory/fsl-corenet-cf.c

index 662d050243bec7b18286b00a6f7d8a7b4f71c245..2fbf8d09af36b19b21d992b918792e8754e1fc22 100644 (file)
@@ -215,10 +215,8 @@ static int ccf_probe(struct platform_device *pdev)
        dev_set_drvdata(&pdev->dev, ccf);
 
        irq = platform_get_irq(pdev, 0);
-       if (!irq) {
-               dev_err(&pdev->dev, "%s: no irq\n", __func__);
-               return -ENXIO;
-       }
+       if (irq < 0)
+               return irq;
 
        ret = devm_request_irq(&pdev->dev, irq, ccf_irq, 0, pdev->name, ccf);
        if (ret) {