All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soc: mdediatek: devapc: use devm_platform_ioremap_resource() instead of of_iomap()
@ 2023-04-14  9:21 ` zhengkang huang
  0 siblings, 0 replies; 6+ messages in thread
From: zhengkang huang @ 2023-04-14  9:21 UTC (permalink / raw)
  To: Matthias Brugger, AngeloGioacchino Del Regno
  Cc: zhengkang huang, Dongliang Mu, linux-kernel, linux-arm-kernel,
	linux-mediatek

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@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] soc: mdediatek: devapc: use devm_platform_ioremap_resource() instead of of_iomap()
@ 2023-04-14  9:21 ` zhengkang huang
  0 siblings, 0 replies; 6+ messages in thread
From: zhengkang huang @ 2023-04-14  9:21 UTC (permalink / raw)
  To: Matthias Brugger, AngeloGioacchino Del Regno
  Cc: zhengkang huang, Dongliang Mu, linux-kernel, linux-arm-kernel,
	linux-mediatek

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@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] soc: mdediatek: devapc: use devm_platform_ioremap_resource() instead of of_iomap()
  2023-04-14  9:21 ` zhengkang huang
@ 2023-04-18 10:09   ` AngeloGioacchino Del Regno
  -1 siblings, 0 replies; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-04-18 10:09 UTC (permalink / raw)
  To: zhengkang huang, Matthias Brugger
  Cc: Dongliang Mu, linux-kernel, linux-arm-kernel, linux-mediatek

Il 14/04/23 11:21, zhengkang huang ha scritto:
> 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@hust.edu.cn>
> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>

You haven't tested this patch on any MediaTek SoC, have you?

This will break devapc.

Regards,
Angelo



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] soc: mdediatek: devapc: use devm_platform_ioremap_resource() instead of of_iomap()
@ 2023-04-18 10:09   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-04-18 10:09 UTC (permalink / raw)
  To: zhengkang huang, Matthias Brugger
  Cc: Dongliang Mu, linux-kernel, linux-arm-kernel, linux-mediatek

Il 14/04/23 11:21, zhengkang huang ha scritto:
> 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@hust.edu.cn>
> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>

You haven't tested this patch on any MediaTek SoC, have you?

This will break devapc.

Regards,
Angelo



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] soc: mdediatek: devapc: use devm_platform_ioremap_resource() instead of of_iomap()
  2023-04-18 10:09   ` AngeloGioacchino Del Regno
@ 2023-04-18 11:49     ` Dongliang Mu
  -1 siblings, 0 replies; 6+ messages in thread
From: Dongliang Mu @ 2023-04-18 11:49 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, zhengkang huang, Matthias Brugger
  Cc: linux-kernel, linux-arm-kernel, linux-mediatek


On 2023/4/18 18:09, AngeloGioacchino Del Regno wrote:
> Il 14/04/23 11:21, zhengkang huang ha scritto:
>> 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@hust.edu.cn>
>> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
>
> You haven't tested this patch on any MediaTek SoC, have you?

Yes, this issue is found by static analysis and remains untested.

Sorry for the functionablity issue.

Dongliang Mu

>
> This will break devapc.
>
> Regards,
> Angelo
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] soc: mdediatek: devapc: use devm_platform_ioremap_resource() instead of of_iomap()
@ 2023-04-18 11:49     ` Dongliang Mu
  0 siblings, 0 replies; 6+ messages in thread
From: Dongliang Mu @ 2023-04-18 11:49 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, zhengkang huang, Matthias Brugger
  Cc: linux-kernel, linux-arm-kernel, linux-mediatek


On 2023/4/18 18:09, AngeloGioacchino Del Regno wrote:
> Il 14/04/23 11:21, zhengkang huang ha scritto:
>> 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@hust.edu.cn>
>> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
>
> You haven't tested this patch on any MediaTek SoC, have you?

Yes, this issue is found by static analysis and remains untested.

Sorry for the functionablity issue.

Dongliang Mu

>
> This will break devapc.
>
> Regards,
> Angelo
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-18 12:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14  9:21 [PATCH] soc: mdediatek: devapc: use devm_platform_ioremap_resource() instead of of_iomap() zhengkang huang
2023-04-14  9:21 ` zhengkang huang
2023-04-18 10:09 ` AngeloGioacchino Del Regno
2023-04-18 10:09   ` AngeloGioacchino Del Regno
2023-04-18 11:49   ` Dongliang Mu
2023-04-18 11:49     ` Dongliang Mu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.