[PATCH] perf/arm-cmn: Fix incorrect error check for devm_ioremap()

Chen Ni nichen at iscas.ac.cn
Thu Mar 26 02:08:56 PDT 2026


Check devm_ioremap() return value for NULL instead of ERR_PTR and return
-ENOMEM on failure. devm_ioremap() never returns ERR_PTR, using IS_ERR()
skips the error path and may cause a NULL pointer dereference.

Fixes: 5394396ff548 ("perf/arm-cmn: Stop claiming entire iomem region")
Signed-off-by: Chen Ni <nichen at iscas.ac.cn>
---
 drivers/perf/arm-cmn.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 1ac91cda6780..9fe00d0f4deb 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -2573,8 +2573,8 @@ static int arm_cmn_probe(struct platform_device *pdev)
 
 	/* Map the whole region now, claim the DTCs once we've found them */
 	cmn->base = devm_ioremap(cmn->dev, cfg->start, resource_size(cfg));
-	if (IS_ERR(cmn->base))
-		return PTR_ERR(cmn->base);
+	if (!cmn->base)
+		return -ENOMEM;
 
 	rootnode = arm_cmn_get_root(cmn, cfg);
 	if (rootnode < 0)
-- 
2.25.1




More information about the linux-arm-kernel mailing list