diff mbox series

[1/2] Revert "thermal/drivers/mediatek: Use devm_of_iomap to avoid resource leak in mtk_thermal_probe"

Message ID 20230529162056.3786301-2-uwu@icenowy.me (mailing list archive)
State New, archived
Headers show
Series thermal/drivers/mediatek: fix a regression affecting other subsystems | expand

Commit Message

Icenowy Zheng May 29, 2023, 4:20 p.m. UTC
This reverts commit f05c7b7d9ea9477fcc388476c6f4ade8c66d2d26.

As the documentation of devm_of_iomap says, it's not a drop-in
replacement for of_iomap because it will detect existed mapping and
prevent shared access to the memory region, Because these two calls
are mapping memory specified in other device nodes, they are meant to be
shared, and devm_of_iomap is not suitable.

Reverts the code back to use of_iomap, to fix a regression of display
failure on my mt8173-elm board.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
---
 drivers/thermal/mediatek/auxadc_thermal.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c
index 0b5528804bbd..f59d36de20a0 100644
--- a/drivers/thermal/mediatek/auxadc_thermal.c
+++ b/drivers/thermal/mediatek/auxadc_thermal.c
@@ -1222,12 +1222,7 @@  static int mtk_thermal_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	auxadc_base = devm_of_iomap(&pdev->dev, auxadc, 0, NULL);
-	if (IS_ERR(auxadc_base)) {
-		of_node_put(auxadc);
-		return PTR_ERR(auxadc_base);
-	}
-
+	auxadc_base = of_iomap(auxadc, 0);
 	auxadc_phys_base = of_get_phys_base(auxadc);
 
 	of_node_put(auxadc);
@@ -1243,12 +1238,7 @@  static int mtk_thermal_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	apmixed_base = devm_of_iomap(&pdev->dev, apmixedsys, 0, NULL);
-	if (IS_ERR(apmixed_base)) {
-		of_node_put(apmixedsys);
-		return PTR_ERR(apmixed_base);
-	}
-
+	apmixed_base = of_iomap(apmixedsys, 0);
 	apmixed_phys_base = of_get_phys_base(apmixedsys);
 
 	of_node_put(apmixedsys);