Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/mediatek: Fix probe device leaks

Make sure to drop the reference taken to each component device during
probe on probe failure (e.g. probe deferral) and on driver unbind.

Fixes: 6ea6f8276725 ("drm/mediatek: Use correct device pointer to get CMDQ client register")
Cc: stable@vger.kernel.org # 5.12
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20250923152340.18234-4-johan@kernel.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>

authored by

Johan Hovold and committed by
Chun-Kuang Hu
2a2a04be 5e492005

+11
+11
drivers/gpu/drm/mediatek/mtk_ddp_comp.c
··· 621 621 return ret; 622 622 } 623 623 624 + static void mtk_ddp_comp_put_device(void *_dev) 625 + { 626 + struct device *dev = _dev; 627 + 628 + put_device(dev); 629 + } 630 + 624 631 static void mtk_ddp_comp_clk_put(void *_clk) 625 632 { 626 633 struct clk *clk = _clk; ··· 662 655 return -EPROBE_DEFER; 663 656 } 664 657 comp->dev = &comp_pdev->dev; 658 + 659 + ret = devm_add_action_or_reset(dev, mtk_ddp_comp_put_device, comp->dev); 660 + if (ret) 661 + return ret; 665 662 666 663 if (type == MTK_DISP_AAL || 667 664 type == MTK_DISP_BLS ||