[PATCH] soc: mdediatek: devapc: use devm_platform_ioremap_resource() instead of of_iomap()

zhengkang huang zkhuang at hust.edu.cn
Fri Apr 14 02:21:13 PDT 2023


In mtk_devapc_probe(), if of_iomap succeeds and any following error occurs,
it needs to deallocate the resource.

Fix this by repalcing of_iomap with devm_platform_ioremap_resource, which
automatically self-manages the resource. This can avoid modifying error
handling code.

Signed-off-by: zhengkang huang <zkhuang at hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91 at hust.edu.cn>
---
 drivers/soc/mediatek/mtk-devapc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/mediatek/mtk-devapc.c b/drivers/soc/mediatek/mtk-devapc.c
index bad139cb117e..bea3ec8ab015 100644
--- a/drivers/soc/mediatek/mtk-devapc.c
+++ b/drivers/soc/mediatek/mtk-devapc.c
@@ -268,7 +268,7 @@ static int mtk_devapc_probe(struct platform_device *pdev)
 	ctx->data = of_device_get_match_data(&pdev->dev);
 	ctx->dev = &pdev->dev;
 
-	ctx->infra_base = of_iomap(node, 0);
+	ctx->infra_base = devm_platform_ioremap_resource(pdev, 0);
 	if (!ctx->infra_base)
 		return -EINVAL;
 
-- 
2.40.0




More information about the Linux-mediatek mailing list