* [PATCH 1/2] soc: mediatek: mtk-devapc: Fix leaking IO map on error paths
@ 2025-01-04 14:20 Krzysztof Kozlowski
2025-01-04 14:20 ` [PATCH 2/2] soc: mediatek: mtk-devapc: Fix leaking IO map on driver remove Krzysztof Kozlowski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-04 14:20 UTC (permalink / raw)
To: Matthias Brugger, AngeloGioacchino Del Regno, Neal Liu,
linux-kernel, linux-arm-kernel, linux-mediatek
Cc: Krzysztof Kozlowski, stable
Error paths of mtk_devapc_probe() should unmap the memory. Reported by
Smatch:
drivers/soc/mediatek/mtk-devapc.c:292 mtk_devapc_probe() warn: 'ctx->infra_base' from of_iomap() not released on lines: 277,281,286.
Fixes: 0890beb22618 ("soc: mediatek: add mt6779 devapc driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
drivers/soc/mediatek/mtk-devapc.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/soc/mediatek/mtk-devapc.c b/drivers/soc/mediatek/mtk-devapc.c
index 2a1adcb87d4e..500847b41b16 100644
--- a/drivers/soc/mediatek/mtk-devapc.c
+++ b/drivers/soc/mediatek/mtk-devapc.c
@@ -273,23 +273,31 @@ static int mtk_devapc_probe(struct platform_device *pdev)
return -EINVAL;
devapc_irq = irq_of_parse_and_map(node, 0);
- if (!devapc_irq)
- return -EINVAL;
+ if (!devapc_irq) {
+ ret = -EINVAL;
+ goto err;
+ }
ctx->infra_clk = devm_clk_get_enabled(&pdev->dev, "devapc-infra-clock");
- if (IS_ERR(ctx->infra_clk))
- return -EINVAL;
+ if (IS_ERR(ctx->infra_clk)) {
+ ret = -EINVAL;
+ goto err;
+ }
ret = devm_request_irq(&pdev->dev, devapc_irq, devapc_violation_irq,
IRQF_TRIGGER_NONE, "devapc", ctx);
if (ret)
- return ret;
+ goto err;
platform_set_drvdata(pdev, ctx);
start_devapc(ctx);
return 0;
+
+err:
+ iounmap(ctx->infra_base);
+ return ret;
}
static void mtk_devapc_remove(struct platform_device *pdev)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] soc: mediatek: mtk-devapc: Fix leaking IO map on driver remove
2025-01-04 14:20 [PATCH 1/2] soc: mediatek: mtk-devapc: Fix leaking IO map on error paths Krzysztof Kozlowski
@ 2025-01-04 14:20 ` Krzysztof Kozlowski
2025-01-07 12:12 ` [PATCH 1/2] soc: mediatek: mtk-devapc: Fix leaking IO map on error paths AngeloGioacchino Del Regno
2025-01-07 12:14 ` AngeloGioacchino Del Regno
2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-04 14:20 UTC (permalink / raw)
To: Matthias Brugger, AngeloGioacchino Del Regno, Neal Liu,
linux-kernel, linux-arm-kernel, linux-mediatek
Cc: Krzysztof Kozlowski, stable
Driver removal should fully clean up - unmap the memory.
Fixes: 0890beb22618 ("soc: mediatek: add mt6779 devapc driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
drivers/soc/mediatek/mtk-devapc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/soc/mediatek/mtk-devapc.c b/drivers/soc/mediatek/mtk-devapc.c
index 500847b41b16..f54c966138b5 100644
--- a/drivers/soc/mediatek/mtk-devapc.c
+++ b/drivers/soc/mediatek/mtk-devapc.c
@@ -305,6 +305,7 @@ static void mtk_devapc_remove(struct platform_device *pdev)
struct mtk_devapc_context *ctx = platform_get_drvdata(pdev);
stop_devapc(ctx);
+ iounmap(ctx->infra_base);
}
static struct platform_driver mtk_devapc_driver = {
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] soc: mediatek: mtk-devapc: Fix leaking IO map on error paths
2025-01-04 14:20 [PATCH 1/2] soc: mediatek: mtk-devapc: Fix leaking IO map on error paths Krzysztof Kozlowski
2025-01-04 14:20 ` [PATCH 2/2] soc: mediatek: mtk-devapc: Fix leaking IO map on driver remove Krzysztof Kozlowski
@ 2025-01-07 12:12 ` AngeloGioacchino Del Regno
2025-01-07 12:14 ` AngeloGioacchino Del Regno
2 siblings, 0 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-01-07 12:12 UTC (permalink / raw)
To: Matthias Brugger, Neal Liu, linux-kernel, linux-arm-kernel,
linux-mediatek, Krzysztof Kozlowski
Cc: stable
On Sat, 04 Jan 2025 15:20:11 +0100, Krzysztof Kozlowski wrote:
> Error paths of mtk_devapc_probe() should unmap the memory. Reported by
> Smatch:
>
> drivers/soc/mediatek/mtk-devapc.c:292 mtk_devapc_probe() warn: 'ctx->infra_base' from of_iomap() not released on lines: 277,281,286.
>
>
Applied to v6.13-next/dts64, thanks!
[1/2] soc: mediatek: mtk-devapc: Fix leaking IO map on error paths
commit: a985d806d231ab40992f59a8bf96acf1b7a94762
[2/2] soc: mediatek: mtk-devapc: Fix leaking IO map on driver remove
commit: c2bcebc6fbf74a5aa5b127349d5cd15577d78cd6
Cheers,
Angelo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] soc: mediatek: mtk-devapc: Fix leaking IO map on error paths
2025-01-04 14:20 [PATCH 1/2] soc: mediatek: mtk-devapc: Fix leaking IO map on error paths Krzysztof Kozlowski
2025-01-04 14:20 ` [PATCH 2/2] soc: mediatek: mtk-devapc: Fix leaking IO map on driver remove Krzysztof Kozlowski
2025-01-07 12:12 ` [PATCH 1/2] soc: mediatek: mtk-devapc: Fix leaking IO map on error paths AngeloGioacchino Del Regno
@ 2025-01-07 12:14 ` AngeloGioacchino Del Regno
2 siblings, 0 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-01-07 12:14 UTC (permalink / raw)
To: Krzysztof Kozlowski, Matthias Brugger, Neal Liu, linux-kernel,
linux-arm-kernel, linux-mediatek
Cc: stable
Il 04/01/25 15:20, Krzysztof Kozlowski ha scritto:
> Error paths of mtk_devapc_probe() should unmap the memory. Reported by
> Smatch:
>
> drivers/soc/mediatek/mtk-devapc.c:292 mtk_devapc_probe() warn: 'ctx->infra_base' from of_iomap() not released on lines: 277,281,286.
>
> Fixes: 0890beb22618 ("soc: mediatek: add mt6779 devapc driver")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Please disregard the previous email;
This series was applied to branch v6.13-next/soc instead.
Cheers,
Angelo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-01-07 12:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-04 14:20 [PATCH 1/2] soc: mediatek: mtk-devapc: Fix leaking IO map on error paths Krzysztof Kozlowski
2025-01-04 14:20 ` [PATCH 2/2] soc: mediatek: mtk-devapc: Fix leaking IO map on driver remove Krzysztof Kozlowski
2025-01-07 12:12 ` [PATCH 1/2] soc: mediatek: mtk-devapc: Fix leaking IO map on error paths AngeloGioacchino Del Regno
2025-01-07 12:14 ` AngeloGioacchino Del Regno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®