Skip to content

Commit e535c23

Browse files
jhovoldmripard
authored andcommitted
drm/imx/tve: fix probe device leak
Make sure to drop the reference taken to the DDC device during probe on probe failure (e.g. probe deferral) and on driver unbind. Fixes: fcbc51e ("staging: drm/imx: Add support for Television Encoder (TVEv2)") Cc: stable@vger.kernel.org # 3.10 Cc: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20251030163456.15807-1-johan@kernel.org Signed-off-by: Maxime Ripard <mripard@kernel.org>
1 parent 12f15d5 commit e535c23

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

drivers/gpu/drm/imx/ipuv3/imx-tve.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,13 @@ static const struct component_ops imx_tve_ops = {
528528
.bind = imx_tve_bind,
529529
};
530530

531+
static void imx_tve_put_device(void *_dev)
532+
{
533+
struct device *dev = _dev;
534+
535+
put_device(dev);
536+
}
537+
531538
static int imx_tve_probe(struct platform_device *pdev)
532539
{
533540
struct device *dev = &pdev->dev;
@@ -549,6 +556,12 @@ static int imx_tve_probe(struct platform_device *pdev)
549556
if (ddc_node) {
550557
tve->ddc = of_find_i2c_adapter_by_node(ddc_node);
551558
of_node_put(ddc_node);
559+
if (tve->ddc) {
560+
ret = devm_add_action_or_reset(dev, imx_tve_put_device,
561+
&tve->ddc->dev);
562+
if (ret)
563+
return ret;
564+
}
552565
}
553566

554567
tve->mode = of_get_tve_mode(np);

0 commit comments

Comments
 (0)