Skip to contentSkip to conversation

drm/imx/tve: fix probe device leak

PATCH In review Johan Hovold 2 participants 6 messages Oct 30, 2025 – Jan 28

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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 fcbc51e54d2a ("staging: drm/imx: Add support for Television Encoder (TVEv2)")
Cc Philipp Zabel <[email protected]>

---

Changes in v2:
- add missing NULL ddc check

 drivers/gpu/drm/imx/ipuv3/imx-tve.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/gpu/drm/imx/ipuv3/imx-tve.c +13 -0
index fd1e617e171e..68bbbdbd347b 100644
@@ -525,6 +525,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;
@@ -546,6 +553,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);
Signature · 1 line
2.51.0
#1 lore raw
Quoted 8 lines · Johan Hovold

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 fcbc51e54d2a ("staging: drm/imx: Add support for Television Encoder (TVEv2)")
Cc Philipp Zabel <[email protected]>
Quoted 4 lines

---

Changes in v2:
- add missing NULL ddc check

Can this one be picked up for 6.19?

Johan

#2 lore raw
Quoted 11 lines · Johan Hovold
Quoted 10 lines · Johan Hovold

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 fcbc51e54d2a ("staging: drm/imx: Add support for Television Encoder (TVEv2)")
Cc Philipp Zabel <[email protected]>

---

Quoted 4 lines
Quoted 2 lines

Changes in v2:
- add missing NULL ddc check

Can this one be picked up for 6.19?

It's been two more months so sending another reminder.

Can this one be merged now?

Johan

#3 lore raw
Quoted 12 lines · Johan Hovold
Quoted 11 lines · Johan Hovold
Quoted 10 lines · Johan Hovold

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 fcbc51e54d2a ("staging: drm/imx: Add support for Television Encoder (TVEv2)")
Cc Philipp Zabel <[email protected]>

---

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Changes in v2:
- add missing NULL ddc check

Can this one be picked up for 6.19?

It's been two more months so sending another reminder.

Can this one be merged now?

Can someone please merge this for 6.20?

Johan

maintainer
#4 lore raw

Hi,

Quoted 16 lines · Johan Hovold
Quoted 15 lines · Johan Hovold
Quoted 14 lines · Johan Hovold
Quoted 12 lines · Johan Hovold

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 fcbc51e54d2a ("staging: drm/imx: Add support for Television Encoder (TVEv2)")
Cc Philipp Zabel <[email protected]>

---

Changes in v2:
- add missing NULL ddc check

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Can this one be picked up for 6.19?

It's been two more months so sending another reminder.

Can this one be merged now?

Can someone please merge this for 6.20?

I'm not sure what went wrong, but I just applied it. It should end up in 6.19.

Maxime

#5 lore raw
Quoted 21 lines · Maxime Ripard

Hi,

Quoted 18 lines · Johan Hovold
Quoted 17 lines · Johan Hovold
Quoted 15 lines · Johan Hovold
Quoted 8 lines · Johan Hovold

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 fcbc51e54d2a ("staging: drm/imx: Add support for Television Encoder (TVEv2)")
Cc Philipp Zabel <[email protected]>
Quoted 4 lines

---

Changes in v2:
- add missing NULL ddc check

Can this one be picked up for 6.19?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

It's been two more months so sending another reminder.

Can this one be merged now?

Can someone please merge this for 6.20?

I'm not sure what went wrong, but I just applied it. It should end up in 6.19.

Thanks, Maxime.

Johan