soc: mediatek: mtk-devapc: Switch to devm_clk_get_enabled()

[ Upstream commit 916120df5a ]

This driver does exactly devm_clk_get() and clk_prepare_enable() right
after, which is exactly what devm_clk_get_enabled() does: clean that
up by switching to the latter.

This commit brings no functional changes.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20221006110935.59695-1-angelogioacchino.delregno@collabora.com
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
Stable-dep-of: c0eb059a4575 ("soc: mediatek: mtk-devapc: Fix leaking IO map on error paths")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
AngeloGioacchino Del Regno
2022-10-06 13:09:35 +02:00
committed by Greg Kroah-Hartman
parent 77779d1258
commit 69fa8a45eb

View File

@@ -276,19 +276,14 @@ static int mtk_devapc_probe(struct platform_device *pdev)
if (!devapc_irq) if (!devapc_irq)
return -EINVAL; return -EINVAL;
ctx->infra_clk = devm_clk_get(&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; return -EINVAL;
if (clk_prepare_enable(ctx->infra_clk))
return -EINVAL;
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)
clk_disable_unprepare(ctx->infra_clk);
return ret; return ret;
}
platform_set_drvdata(pdev, ctx); platform_set_drvdata(pdev, ctx);
@@ -303,8 +298,6 @@ static int mtk_devapc_remove(struct platform_device *pdev)
stop_devapc(ctx); stop_devapc(ctx);
clk_disable_unprepare(ctx->infra_clk);
return 0; return 0;
} }