mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
soc: mediatek: mtk-devapc: Fix leaking IO map on error paths
[ Upstream commit c0eb059a4575ed57f265d9883a5203799c19982c ]
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: 0890beb226 ("soc: mediatek: add mt6779 devapc driver")
Cc: stable@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20250104142012.115974-1-krzysztof.kozlowski@linaro.org
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
69fa8a45eb
commit
ae86c01537
@@ -273,23 +273,31 @@ static int mtk_devapc_probe(struct platform_device *pdev)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
devapc_irq = irq_of_parse_and_map(node, 0);
|
devapc_irq = irq_of_parse_and_map(node, 0);
|
||||||
if (!devapc_irq)
|
if (!devapc_irq) {
|
||||||
return -EINVAL;
|
ret = -EINVAL;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
ctx->infra_clk = devm_clk_get_enabled(&pdev->dev, "devapc-infra-clock");
|
ctx->infra_clk = devm_clk_get_enabled(&pdev->dev, "devapc-infra-clock");
|
||||||
if (IS_ERR(ctx->infra_clk))
|
if (IS_ERR(ctx->infra_clk)) {
|
||||||
return -EINVAL;
|
ret = -EINVAL;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
ret = devm_request_irq(&pdev->dev, devapc_irq, devapc_violation_irq,
|
ret = devm_request_irq(&pdev->dev, devapc_irq, devapc_violation_irq,
|
||||||
IRQF_TRIGGER_NONE, "devapc", ctx);
|
IRQF_TRIGGER_NONE, "devapc", ctx);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto err;
|
||||||
|
|
||||||
platform_set_drvdata(pdev, ctx);
|
platform_set_drvdata(pdev, ctx);
|
||||||
|
|
||||||
start_devapc(ctx);
|
start_devapc(ctx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err:
|
||||||
|
iounmap(ctx->infra_base);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mtk_devapc_remove(struct platform_device *pdev)
|
static int mtk_devapc_remove(struct platform_device *pdev)
|
||||||
|
|||||||
Reference in New Issue
Block a user