Skip to contentSkip to conversation

drm/bridge: fix OF node leaks

PATCH Applied Johan Hovold 3 participants 8 messages Jul 8, 2025 – Aug 2, 2025

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

cover drm/bridge: fix OF node leaks

Make sure to drop the OF node references taken when creating bridge device when the devices are later released.

Johan

Johan Hovold (2):
drm/bridge: fix OF node leak
drm/bridge: ti-sn65dsi86: fix OF node leak

 drivers/gpu/drm/bridge/aux-bridge.c   | 2 ++
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 2 ++
 2 files changed, 4 insertions(+)
Signature · 1 line
2.49.0
#1 lore raw

PATCH 1/2 drm/bridge: fix OF node leak

Make sure to drop the OF node reference taken when creating the aux bridge device when the device is later released.

Fixes 6914968a0b52 ("drm/bridge: properly refcount DT nodes in aux bridge drivers")
Cc Dmitry Baryshkov <[email protected]>
---
 drivers/gpu/drm/bridge/aux-bridge.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/bridge/aux-bridge.c +2 -0
index c179b86d208f..6642ac6819a0 100644
@@ -17,6 +17,7 @@ static void drm_aux_bridge_release(struct device *dev)
 {
 	struct auxiliary_device *adev = to_auxiliary_dev(dev);
 
+	of_node_put(dev->of_node);
 	ida_free(&drm_aux_bridge_ida, adev->id);
 
 	kfree(adev);
@@ -64,6 +65,7 @@ int drm_aux_bridge_register(struct device *parent)
 
 	ret = auxiliary_device_init(adev);
 	if (ret) {
+		of_node_put(adev->dev.of_node);
 		ida_free(&drm_aux_bridge_ida, adev->id);
 		kfree(adev);
 		return ret;
Signature · 1 line
2.49.0
#2 lore raw

Re: [PATCH 1/2] drm/bridge: fix OF node leak

Quoted 7 lines · Johan Hovold

Make sure to drop the OF node reference taken when creating the aux bridge device when the device is later released.

Fixes 6914968a0b52 ("drm/bridge: properly refcount DT nodes in aux bridge drivers")
Cc Dmitry Baryshkov <[email protected]>

---

Any chance we can get this one into 6.17-rc1?

Johan

Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] drm/bridge: fix OF node leak

In reply to Johan Hovold
Quoted 10 lines · Johan Hovold

Make sure to drop the OF node reference taken when creating the aux bridge device when the device is later released.

Fixes 6914968a0b52 ("drm/bridge: properly refcount DT nodes in aux bridge drivers")
Cc Dmitry Baryshkov <[email protected]>
---
 drivers/gpu/drm/bridge/aux-bridge.c | 2 ++
 1 file changed, 2 insertions(+)

PLease excuse me for the delay.

Signature · 2 lines
With best wishes
Dmitry
#4 lore raw

PATCH 2/2 drm/bridge: ti-sn65dsi86: fix OF node leak

In reply to Johan Hovold

Make sure to drop the OF node reference taken when creating the bridge device when the device is later released.

Fixes a1e3667a9835 ("drm/bridge: ti-sn65dsi86: Promote the AUX channel to its own sub-dev")
Cc Douglas Anderson <[email protected]>
---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +2 -0
index de9c23537465..79f4d02f24cb 100644
@@ -467,6 +467,7 @@ static void ti_sn65dsi86_aux_device_release(struct device *dev)
 {
 	struct auxiliary_device *aux = container_of(dev, struct auxiliary_device, dev);
 
+	of_node_put(dev->of_node);
 	kfree(aux);
 }
 
@@ -490,6 +491,7 @@ static int ti_sn65dsi86_add_aux_device(struct ti_sn65dsi86 *pdata,
 	device_set_of_node_from_dev(&aux->dev, dev);
 	ret = auxiliary_device_init(aux);
 	if (ret) {
+		of_node_put(aux->dev.of_node);
 		kfree(aux);
 		return ret;
 	}
Signature · 1 line
2.49.0
reviewer
#5 lore raw

Re: [PATCH 2/2] drm/bridge: ti-sn65dsi86: fix OF node leak

Hi,

Quoted 10 lines · Johan Hovold

Make sure to drop the OF node reference taken when creating the bridge device when the device is later released.

Fixes a1e3667a9835 ("drm/bridge: ti-sn65dsi86: Promote the AUX channel to its own sub-dev")
Cc Douglas Anderson <[email protected]>
---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 2 ++
 1 file changed, 2 insertions(+)

The patch doesn't apply to drm-misc-next, which has commit 6526b02e1020 ("drm/bridge: ti-sn65dsi86: use the auxiliary device"). Seems like you need to resubmit as a patch to the new auxiliary_device_create() function? Do you feel that this is urgent enough that we need a separate patch for stable?

-Doug

#6 lore raw

Re: [PATCH 2/2] drm/bridge: ti-sn65dsi86: fix OF node leak

Quoted 12 lines · Doug Anderson
Quoted 9 lines · Johan Hovold

Make sure to drop the OF node reference taken when creating the bridge device when the device is later released.

Fixes a1e3667a9835 ("drm/bridge: ti-sn65dsi86: Promote the AUX channel to its own sub-dev")
Cc Douglas Anderson <[email protected]>
---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 4 lines

The patch doesn't apply to drm-misc-next, which has commit 6526b02e1020 ("drm/bridge: ti-sn65dsi86: use the auxiliary device"). Seems like you need to resubmit as a patch to the new auxiliary_device_create() function?

I've already sent a fix for the generic implementation here:

	https://lore.kernel.org/lkml/[email protected]/
Quoted 2 lines

Do you feel that this is urgent
enough that we need a separate patch for stable?

No, we should be good then as I assume this bridge is typically registered at boot and never deregistered (that's also why I left out the stable tag).

Johan

#7 lore raw

Re: (subset) [PATCH 0/2] drm/bridge: fix OF node leaks

In reply to Johan Hovold
Quoted 11 lines · Johan Hovold

Make sure to drop the OF node references taken when creating bridge device when the devices are later released.

Johan

Johan Hovold (2):
drm/bridge: fix OF node leak
drm/bridge: ti-sn65dsi86: fix OF node leak

[...]

Applied to drm-misc-next-fixes, thanks!

[1/2] drm/bridge: fix OF node leak

      commit: be71ce9796c36517c677ab1d3c6691423dd0bdec

Best regards,

Signature · 2 lines
With best wishes
Dmitry