Skip to contentSkip to conversation

perf/marvell_cn10k_tad_pmu: Fix return value check in tad_pmu_probe()

PATCH In review Yang Yingliang 2 participants 2 messages Dec 21, 2021 – Jan 4, 2022 Arm PMU profiling and debugging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf/marvell_cn10k_tad_pmu: Fix return value check in tad_pmu_probe()

In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes 036a7584bede ("drivers: perf: Add LLC-TAD perf counter support")
---
 drivers/perf/marvell_cn10k_tad_pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/marvell_cn10k_tad_pmu.c +1 -1
index 250dd4c52d70..7f4d292658e3 100644
@@ -312,7 +312,7 @@ static int tad_pmu_probe(struct platform_device *pdev)
 		regions[i].base = devm_ioremap(&pdev->dev,
 					       res->start,
 					       tad_pmu_page_size);
-		if (IS_ERR(regions[i].base)) {
+		if (!regions[i].base) {
 			dev_err(&pdev->dev, "TAD%d ioremap fail\n", i);
 			return -ENOMEM;
 		}
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 16 lines · Yang Yingliang

In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes 036a7584bede ("drivers: perf: Add LLC-TAD perf counter support")
---
 drivers/perf/marvell_cn10k_tad_pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/marvell_cn10k_tad_pmu.c +0 -0
index 250dd4c52d70..7f4d292658e3 100644

drivers/perf/marvell_cn10k_tad_pmu.c static int tad_pmu_probe(struct platform_device *pdev) · line 317

Quoted 7 lines
drivers/perf/marvell_cn10k_tad_pmu.c +1 -1
@@ -312,7 +312,7 @@ static int tad_pmu_probe(struct platform_device *pdev)
 		regions[i].base = devm_ioremap(&pdev->dev,
 					       res->start,
 					       tad_pmu_page_size);
-		if (IS_ERR(regions[i].base)) {
+		if (!regions[i].base) {
 			dev_err(&pdev->dev, "TAD%d ioremap fail\n", i);
 			return -ENOMEM;

Thanks, but Dan already caught this:

https://lore.kernel.org/r/20211217145907.GA16611@kili

I'll push out his fix soon.

Will