mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2
@ 2026-07-13 11:29 Guangshuo Li
  2026-07-13 13:56 ` Johan Hovold
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Guangshuo Li @ 2026-07-13 11:29 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Simona Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno, CK Hu,
	Louis-Alexis Eyraud, dri-devel, linux-mediatek, linux-kernel,
	linux-arm-kernel
  Cc: Johan Hovold, Guangshuo Li, stable

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 of_find_i2c_adapter_by_node(): it drops
the adapter device reference before the devm action drops it again, and
it also puts a module reference that was never taken.

Remove the extra i2c_put_adapter() call and drop the now-empty HDMI v2
remove callback. The common devm action releases the adapter device
reference.

Fixes: 8d0f79886273 ("drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188")
Cc: stable@vger.kernel.org
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
v3:
  - Add Reviewed-by tag from Johan Hovold.
  - No code changes.

v2:
  - Drop the empty remove callback, as suggested by Johan Hovold.
  - Mention that i2c_put_adapter() also drops a module reference that was
    never taken.
  - Fix the Fixes tag.
  - Add Cc stable.

 drivers/gpu/drm/mediatek/mtk_hdmi_v2.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
index 7bbf463056c9..ffe456238a2b 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
@@ -1499,13 +1499,6 @@ static int mtk_hdmi_v2_probe(struct platform_device *pdev)
 	return 0;
 }
 
-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[] = {
 	{ .compatible = "mediatek,mt8188-hdmi-tx", .data = &mtk_hdmi_conf_mt8188 },
 	{ .compatible = "mediatek,mt8195-hdmi-tx", .data = &mtk_hdmi_conf_mt8195 },
@@ -1515,7 +1508,6 @@ MODULE_DEVICE_TABLE(of, mtk_drm_hdmi_v2_of_ids);
 
 static struct platform_driver mtk_hdmi_v2_driver = {
 	.probe = mtk_hdmi_v2_probe,
-	.remove = mtk_hdmi_v2_remove,
 	.driver = {
 		.name = "mediatek-drm-hdmi-v2",
 		.of_match_table = mtk_drm_hdmi_v2_of_ids,
-- 
2.43.0


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

* Re: [PATCH v3] drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2
  2026-07-13 11:29 [PATCH v3] drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2 Guangshuo Li
@ 2026-07-13 13:56 ` Johan Hovold
  2026-07-16  2:39 ` CK Hu (胡俊光)
  2026-07-23 23:00 ` Chun-Kuang Hu
  2 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2026-07-13 13:56 UTC (permalink / raw)
  To: Guangshuo Li
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Simona Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno, CK Hu,
	Louis-Alexis Eyraud, dri-devel, linux-mediatek, linux-kernel,
	linux-arm-kernel, stable

On Mon, Jul 13, 2026 at 07:29:57PM +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 of_find_i2c_adapter_by_node(): it drops
> the adapter device reference before the devm action drops it again, and
> it also puts a module reference that was never taken.
> 
> Remove the extra i2c_put_adapter() call and drop the now-empty HDMI v2
> remove callback. The common devm action releases the adapter device
> reference.
> 
> Fixes: 8d0f79886273 ("drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188")
> Cc: stable@vger.kernel.org
> Reviewed-by: Johan Hovold <johan@kernel.org>
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
> v3:
>   - Add Reviewed-by tag from Johan Hovold.
>   - No code changes.

No need to resend just to add a tag. It will be added when the patch is
applied.

Johan

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

* Re: [PATCH v3] drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2
  2026-07-13 11:29 [PATCH v3] drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2 Guangshuo Li
  2026-07-13 13:56 ` Johan Hovold
@ 2026-07-16  2:39 ` CK Hu (胡俊光)
  2026-07-23 23:00 ` Chun-Kuang Hu
  2 siblings, 0 replies; 4+ messages in thread
From: CK Hu (胡俊光) @ 2026-07-16  2:39 UTC (permalink / raw)
  To: chunkuang.hu, simona, AngeloGioacchino Del Regno, dri-devel,
	airlied, lgs201920130244, linux-arm-kernel, p.zabel,
	matthias.bgg, Louis-Alexis Eyraud, linux-kernel, linux-mediatek
  Cc: stable, johan

On Mon, 2026-07-13 at 19:29 +0800, Guangshuo Li wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> 
> 
> 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 of_find_i2c_adapter_by_node(): it drops
> the adapter device reference before the devm action drops it again, and
> it also puts a module reference that was never taken.
> 
> Remove the extra i2c_put_adapter() call and drop the now-empty HDMI v2
> remove callback. The common devm action releases the adapter device
> reference.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Fixes: 8d0f79886273 ("drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188")
> Cc: stable@vger.kernel.org
> Reviewed-by: Johan Hovold <johan@kernel.org>
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
> 


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

* Re: [PATCH v3] drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2
  2026-07-13 11:29 [PATCH v3] drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2 Guangshuo Li
  2026-07-13 13:56 ` Johan Hovold
  2026-07-16  2:39 ` CK Hu (胡俊光)
@ 2026-07-23 23:00 ` Chun-Kuang Hu
  2 siblings, 0 replies; 4+ messages in thread
From: Chun-Kuang Hu @ 2026-07-23 23:00 UTC (permalink / raw)
  To: Guangshuo Li
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Simona Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno, CK Hu,
	Louis-Alexis Eyraud, dri-devel, linux-mediatek, linux-kernel,
	linux-arm-kernel, Johan Hovold, stable

Guangshuo Li <lgs201920130244@gmail.com> 於 2026年7月13日週一 上午11:32寫道:
>
> 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 of_find_i2c_adapter_by_node(): it drops
> the adapter device reference before the devm action drops it again, and
> it also puts a module reference that was never taken.
>
> Remove the extra i2c_put_adapter() call and drop the now-empty HDMI v2
> remove callback. The common devm action releases the adapter device
> reference.

Applied to mediatek-drm-fixes [1], thanks.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-fixes

Regards,
Chun-Kuang.

>
> Fixes: 8d0f79886273 ("drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188")
> Cc: stable@vger.kernel.org
> Reviewed-by: Johan Hovold <johan@kernel.org>
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---

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

end of thread, other threads:[~2026-07-23 23:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-13 11:29 [PATCH v3] drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2 Guangshuo Li
2026-07-13 13:56 ` Johan Hovold
2026-07-16  2:39 ` CK Hu (胡俊光)
2026-07-23 23:00 ` Chun-Kuang 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®