Skip to content

Commit e0f44f7

Browse files
jhovoldChun-Kuang Hu
authored andcommitted
drm/mediatek: ovl_adaptor: Fix probe device leaks
Make sure to drop the references taken to the component devices by of_find_device_by_node() during probe on probe failure (e.g. probe deferral) and on driver unbind. Fixes: 453c336 ("drm/mediatek: Add ovl_adaptor support for MT8195") Cc: stable@vger.kernel.org # 6.4 Cc: Nancy.Lin <nancy.lin@mediatek.com> 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-6-johan@kernel.org/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
1 parent 2a2a04b commit e0f44f7

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,13 @@ bool mtk_ovl_adaptor_is_comp_present(struct device_node *node)
527527
type == OVL_ADAPTOR_TYPE_PADDING;
528528
}
529529

530+
static void ovl_adaptor_put_device(void *_dev)
531+
{
532+
struct device *dev = _dev;
533+
534+
put_device(dev);
535+
}
536+
530537
static int ovl_adaptor_comp_init(struct device *dev, struct component_match **match)
531538
{
532539
struct mtk_disp_ovl_adaptor *priv = dev_get_drvdata(dev);
@@ -560,6 +567,11 @@ static int ovl_adaptor_comp_init(struct device *dev, struct component_match **ma
560567
if (!comp_pdev)
561568
return -EPROBE_DEFER;
562569

570+
ret = devm_add_action_or_reset(dev, ovl_adaptor_put_device,
571+
&comp_pdev->dev);
572+
if (ret)
573+
return ret;
574+
563575
priv->ovl_adaptor_comp[id] = &comp_pdev->dev;
564576

565577
drm_of_component_match_add(dev, match, component_compare_of, node);

0 commit comments

Comments
 (0)