Skip to content

Commit ca68745

Browse files
jhovoldgregkh
authored andcommitted
drm/imx/tve: fix probe device leak
commit e535c23 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 31203f5 commit ca68745

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
@@ -525,6 +525,13 @@ static const struct component_ops imx_tve_ops = {
525525
.bind = imx_tve_bind,
526526
};
527527

528+
static void imx_tve_put_device(void *_dev)
529+
{
530+
struct device *dev = _dev;
531+
532+
put_device(dev);
533+
}
534+
528535
static int imx_tve_probe(struct platform_device *pdev)
529536
{
530537
struct device *dev = &pdev->dev;
@@ -546,6 +553,12 @@ static int imx_tve_probe(struct platform_device *pdev)
546553
if (ddc_node) {
547554
tve->ddc = of_find_i2c_adapter_by_node(ddc_node);
548555
of_node_put(ddc_node);
556+
if (tve->ddc) {
557+
ret = devm_add_action_or_reset(dev, imx_tve_put_device,
558+
&tve->ddc->dev);
559+
if (ret)
560+
return ret;
561+
}
549562
}
550563

551564
tve->mode = of_get_tve_mode(np);

0 commit comments

Comments
 (0)