Skip to content

Commit

Permalink
Merge tag 'mtk-soc-for-v6.14' of https://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/mediatek/linux into soc/drivers

MediaTek soc driver updates for v6.14

This adds fixes avoiding iomap leaks on error paths in
the MediaTek devapc driver.

* tag 'mtk-soc-for-v6.14' of https://git.kernel.org/pub/scm/linux/kernel/git/mediatek/linux:
  soc: mediatek: mtk-devapc: Fix leaking IO map on driver remove
  soc: mediatek: mtk-devapc: Fix leaking IO map on error paths

Link: https://lore.kernel.org/r/20250108100826.32458-2-angelogioacchino.delregno@collabora.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Arnd Bergmann committed Jan 15, 2025
2 parents 25205fe + c9c0036 commit f783d74
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions drivers/soc/mediatek/mtk-devapc.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,30 +273,39 @@ 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)
{
struct mtk_devapc_context *ctx = platform_get_drvdata(pdev);

stop_devapc(ctx);
iounmap(ctx->infra_base);
}

static struct platform_driver mtk_devapc_driver = {
Expand Down

0 comments on commit f783d74

Please sign in to comment.