[PATCH] irqchip/starfive: Fix error check for devm_platform_ioremap_resource()

Chen Ni posted 1 patch 1 month, 1 week ago
There is a newer version of this series
drivers/irqchip/irq-starfive-jhb100-intc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] irqchip/starfive: Fix error check for devm_platform_ioremap_resource()
Posted by Chen Ni 1 month, 1 week ago
The devm_platform_ioremap_resource() function 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>
---
 drivers/irqchip/irq-starfive-jhb100-intc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-starfive-jhb100-intc.c b/drivers/irqchip/irq-starfive-jhb100-intc.c
index 0d5914813afd..838885b02f34 100644
--- a/drivers/irqchip/irq-starfive-jhb100-intc.c
+++ b/drivers/irqchip/irq-starfive-jhb100-intc.c
@@ -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))
-- 
2.25.1
[tip: irq/drivers] irqchip/starfive: Fix error check for devm_platform_ioremap_resource()
Posted by tip-bot2 for Chen Ni 1 month, 1 week ago
The following commit has been merged into the irq/drivers branch of tip:

Commit-ID:     8b9db67396105f6b95bcc57a354e50ac20705704
Gitweb:        https://git.kernel.org/tip/8b9db67396105f6b95bcc57a354e50ac20705704
Author:        Chen Ni <nichen@iscas.ac.cn>
AuthorDate:    Wed, 06 May 2026 12:14:13 +08:00
Committer:     Thomas Gleixner <tglx@kernel.org>
CommitterDate: Wed, 06 May 2026 09:13:12 +02:00

irqchip/starfive: Fix error check for devm_platform_ioremap_resource()

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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-starfive-jhb100-intc.c b/drivers/irqchip/irq-starfive-jhb100-intc.c
index 0d59148..838885b 100644
--- a/drivers/irqchip/irq-starfive-jhb100-intc.c
+++ b/drivers/irqchip/irq-starfive-jhb100-intc.c
@@ -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))