]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
irqchip/starfive: Fix error check for devm_platform_ioremap_resource()
authorChen Ni <nichen@iscas.ac.cn>
Wed, 6 May 2026 04:14:13 +0000 (12:14 +0800)
committerThomas Gleixner <tglx@kernel.org>
Wed, 6 May 2026 07:13:12 +0000 (09:13 +0200)
devm_platform_ioremap_resource() returns an error pointer on failure, not
NULL.

Fix the check to use IS_ERR() and return PTR_ERR() to correctly handle
allocation failures.

Fixes: 2f59ca185497 ("irqchip/starfive: Use devm_ interfaces to simplify resource release")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com>
Link: https://patch.msgid.link/20260506041413.1670799-1-nichen@iscas.ac.cn
drivers/irqchip/irq-starfive-jhb100-intc.c

index 0d5914813afd21a53dc15988bd7a4f5ea4ae5b39..838885b02f3439b122fd683fcc1e0cf33ec895cf 100644 (file)
@@ -208,8 +208,8 @@ static int starfive_intc_probe(struct platform_device *pdev, struct device_node
                return -ENOMEM;
 
        irqc->base = devm_platform_ioremap_resource(pdev, 0);
-       if (!irqc->base)
-               return dev_err_probe(&pdev->dev, -ENXIO, "unable to map registers\n");
+       if (IS_ERR(irqc->base))
+               return dev_err_probe(&pdev->dev, PTR_ERR(irqc->base), "unable to map registers\n");
 
        rst = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev, NULL);
        if (IS_ERR(rst))