Skip to content

Commit 8f05959

Browse files
jhovoldgregkh
authored andcommitted
drm/mediatek: Fix probe device leaks
commit 2a2a04b upstream. 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: 6ea6f82 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e048e15 commit 8f05959

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

drivers/gpu/drm/mediatek/mtk_ddp_comp.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,13 @@ int mtk_find_possible_crtcs(struct drm_device *drm, struct device *dev)
621621
return ret;
622622
}
623623

624+
static void mtk_ddp_comp_put_device(void *_dev)
625+
{
626+
struct device *dev = _dev;
627+
628+
put_device(dev);
629+
}
630+
624631
static void mtk_ddp_comp_clk_put(void *_clk)
625632
{
626633
struct clk *clk = _clk;
@@ -656,6 +663,10 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node, struct mtk_d
656663
}
657664
comp->dev = &comp_pdev->dev;
658665

666+
ret = devm_add_action_or_reset(dev, mtk_ddp_comp_put_device, comp->dev);
667+
if (ret)
668+
return ret;
669+
659670
if (type == MTK_DISP_AAL ||
660671
type == MTK_DISP_BLS ||
661672
type == MTK_DISP_CCORR ||

0 commit comments

Comments
 (0)