Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2
@ 2026-07-04 17:41 Guangshuo Li
  2026-07-05 12:01 ` Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: Guangshuo Li @ 2026-07-04 17:41 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Simona Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno, Johan Hovold,
	dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel
  Cc: Guangshuo Li

mtk_hdmi_common_probe() gets the DDC adapter with
of_find_i2c_adapter_by_node() and registers a devm action to release the
adapter device reference with put_device().

The HDMI v2 remove callback also calls i2c_put_adapter() on the same DDC
adapter. This is not paired with the find helper and it drops the adapter
device reference before the devm action drops it again.

Remove the extra i2c_put_adapter() call from the HDMI v2 remove callback
and let the common devm action release the adapter device reference.

Fixes: 9545bae5c8ac ("drm/mediatek: mtk_hdmi: Fix probe device leaks")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/gpu/drm/mediatek/mtk_hdmi_v2.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
index 7bbf463056c9..e668506daf67 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
@@ -1501,9 +1501,6 @@ static int mtk_hdmi_v2_probe(struct platform_device *pdev)
 
 static void mtk_hdmi_v2_remove(struct platform_device *pdev)
 {
-	struct mtk_hdmi *hdmi = platform_get_drvdata(pdev);
-
-	i2c_put_adapter(hdmi->ddc_adpt);
 }
 
 static const struct of_device_id mtk_drm_hdmi_v2_of_ids[] = {
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2
  2026-07-04 17:41 [PATCH] drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2 Guangshuo Li
@ 2026-07-05 12:01 ` Johan Hovold
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2026-07-05 12:01 UTC (permalink / raw)
  To: Guangshuo Li
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Simona Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno, dri-devel,
	linux-mediatek, linux-kernel, linux-arm-kernel

On Sun, Jul 05, 2026 at 01:41:13AM +0800, Guangshuo Li wrote:
> mtk_hdmi_common_probe() gets the DDC adapter with
> of_find_i2c_adapter_by_node() and registers a devm action to release the
> adapter device reference with put_device().
> 
> The HDMI v2 remove callback also calls i2c_put_adapter() on the same DDC
> adapter. This is not paired with the find helper and it drops the adapter
> device reference before the devm action drops it again.

You should mention that i2c_put_adapter() also puts a module reference
that was never taken (of_find_i2c_adapter_by_node() does not take a
module reference, unlike of_get_i2c_adapter_by_node()).

> Remove the extra i2c_put_adapter() call from the HDMI v2 remove callback
> and let the common devm action release the adapter device reference.
> 
> Fixes: 9545bae5c8ac ("drm/mediatek: mtk_hdmi: Fix probe device leaks")

This is clearly not the change that introduced the issue as this driver
did not exist when it was merged.

This should be:

Fixes: 8d0f79886273 ("drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188")

You should also CC stable.

> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_hdmi_v2.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
> index 7bbf463056c9..e668506daf67 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
> @@ -1501,9 +1501,6 @@ static int mtk_hdmi_v2_probe(struct platform_device *pdev)
>  
>  static void mtk_hdmi_v2_remove(struct platform_device *pdev)
>  {
> -	struct mtk_hdmi *hdmi = platform_get_drvdata(pdev);
> -
> -	i2c_put_adapter(hdmi->ddc_adpt);
>  }

There's no point in keeping the empty remove() callback.

>  static const struct of_device_id mtk_drm_hdmi_v2_of_ids[] = {

Johan


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-05 12:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-04 17:41 [PATCH] drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2 Guangshuo Li
2026-07-05 12:01 ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox