]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2
authorGuangshuo Li <lgs201920130244@gmail.com>
Mon, 13 Jul 2026 11:29:57 +0000 (19:29 +0800)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Wed, 22 Jul 2026 23:29:48 +0000 (23:29 +0000)
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>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20260713112957.884640-1-lgs201920130244@gmail.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_hdmi_v2.c

index 7bbf463056c952c29bef1bcf1983254ecc857ed7..ffe456238a2bff1c44b46b8759ab402fec9c6fe0 100644 (file)
@@ -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,