* [PATCH] drm/mediatek: mtk_hdmi_common: Fix clock reference leaks
@ 2026-11-19 3:17 Haoxiang Li
2026-11-25 3:02 ` CK Hu (胡俊光)
0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2026-11-19 3:17 UTC (permalink / raw)
To: chunkuang.hu, p.zabel, airlied, simona, matthias.bgg,
angelogioacchino.delregno, junzhi.zhao, jie.qiu
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel, Haoxiang Li
mtk_hdmi_get_all_clk() acquires clock references using
of_clk_get_by_name(), but these references are never released.
They leak when a later clock lookup or subsequent probe step
fails, as well as on driver unbind.
Use devm_clk_get() to automatically release each successfully acquired
clock reference on probe failure or driver unbind. Remove the now
unused device-node parameter from mtk_hdmi_get_all_clk() and update
its caller.
Fixes: 8f83f26891e1 ("drm/mediatek: Add HDMI support")
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
drivers/gpu/drm/mediatek/mtk_hdmi_common.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
index a36d8dd6b761..8e8ea4111351 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
@@ -199,13 +199,13 @@ void mtk_hdmi_audio_set_plugged_cb(struct mtk_hdmi *hdmi, hdmi_codec_plugged_cb
}
EXPORT_SYMBOL_NS_GPL(mtk_hdmi_audio_set_plugged_cb, "DRM_MTK_HDMI");
-static int mtk_hdmi_get_all_clk(struct mtk_hdmi *hdmi, struct device_node *np,
+static int mtk_hdmi_get_all_clk(struct mtk_hdmi *hdmi,
const char * const *clock_names, size_t num_clocks)
{
int i;
for (i = 0; i < num_clocks; i++) {
- hdmi->clk[i] = of_clk_get_by_name(np, clock_names[i]);
+ hdmi->clk[i] = devm_clk_get(hdmi->dev, clock_names[i]);
if (IS_ERR(hdmi->clk[i]))
return PTR_ERR(hdmi->clk[i]);
@@ -305,7 +305,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, struct platform_device
struct device_node *remote, *i2c_np;
int ret;
- ret = mtk_hdmi_get_all_clk(hdmi, np, clk_names, num_clocks);
+ ret = mtk_hdmi_get_all_clk(hdmi, clk_names, num_clocks);
if (ret)
return dev_err_probe(dev, ret, "Failed to get clocks\n");
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/mediatek: mtk_hdmi_common: Fix clock reference leaks
2026-11-19 3:17 [PATCH] drm/mediatek: mtk_hdmi_common: Fix clock reference leaks Haoxiang Li
@ 2026-11-25 3:02 ` CK Hu (胡俊光)
0 siblings, 0 replies; 2+ messages in thread
From: CK Hu (胡俊光) @ 2026-11-25 3:02 UTC (permalink / raw)
To: chunkuang.hu, haoxiang_li2024, AngeloGioacchino Del Regno,
junzhi.zhao, airlied, jie.qiu, simona, p.zabel, matthias.bgg
Cc: dri-devel, linux-mediatek, linux-arm-kernel, linux-kernel
On Thu, 2026-11-19 at 11:17 +0800, Haoxiang Li wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> mtk_hdmi_get_all_clk() acquires clock references using
> of_clk_get_by_name(), but these references are never released.
> They leak when a later clock lookup or subsequent probe step
> fails, as well as on driver unbind.
>
> Use devm_clk_get() to automatically release each successfully acquired
> clock reference on probe failure or driver unbind. Remove the now
> unused device-node parameter from mtk_hdmi_get_all_clk() and update
> its caller.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
>
> Fixes: 8f83f26891e1 ("drm/mediatek: Add HDMI support")
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-25 3:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 3:17 [PATCH] drm/mediatek: mtk_hdmi_common: Fix clock reference leaks Haoxiang Li
2026-11-25 3:02 ` CK Hu (胡俊光)
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®