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

Johan Hovold posted 2 patches 3 months ago
[PATCH 2/2] drm/bridge: ti-sn65dsi86: fix OF node leak
Posted by Johan Hovold 3 months ago
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 <dianders@chromium.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
index de9c23537465..79f4d02f24cb 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
@@ -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;
 	}
-- 
2.49.0
Re: [PATCH 2/2] drm/bridge: ti-sn65dsi86: fix OF node leak
Posted by Doug Anderson 2 months, 3 weeks ago
Hi,

On Tue, Jul 8, 2025 at 1:52 AM Johan Hovold <johan@kernel.org> wrote:
>
> 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 <dianders@chromium.org>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  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
Re: [PATCH 2/2] drm/bridge: ti-sn65dsi86: fix OF node leak
Posted by Johan Hovold 2 months, 3 weeks ago
On Mon, Jul 14, 2025 at 11:46:12AM -0700, Doug Anderson wrote:
> On Tue, Jul 8, 2025 at 1:52 AM Johan Hovold <johan@kernel.org> wrote:

> > 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 <dianders@chromium.org>
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> > ---
> >  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?

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

	https://lore.kernel.org/lkml/20250708084654.15145-1-johan@kernel.org/

> 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