Unverified Commit e535c235 authored by Johan Hovold's avatar Johan Hovold Committed by Maxime Ripard
Browse files

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: fcbc51e5 ("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: default avatarFrank Li <Frank.Li@nxp.com>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20251030163456.15807-1-johan@kernel.org


Signed-off-by: default avatarMaxime Ripard <mripard@kernel.org>
parent 12f15d52
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -528,6 +528,13 @@ static const struct component_ops imx_tve_ops = {
	.bind	= imx_tve_bind,
};

static void imx_tve_put_device(void *_dev)
{
	struct device *dev = _dev;

	put_device(dev);
}

static int imx_tve_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
@@ -549,6 +556,12 @@ static int imx_tve_probe(struct platform_device *pdev)
	if (ddc_node) {
		tve->ddc = of_find_i2c_adapter_by_node(ddc_node);
		of_node_put(ddc_node);
		if (tve->ddc) {
			ret = devm_add_action_or_reset(dev, imx_tve_put_device,
						       &tve->ddc->dev);
			if (ret)
				return ret;
		}
	}

	tve->mode = of_get_tve_mode(np);