lt9611_parse_dt() keeps references to the remote DSI nodes for the later
MIPI DSI attach step. Probe releases those references through
err_of_put, but that label is only reached after parse_dt() succeeds.

If the next bridge lookup fails, parse_dt() returns directly and leaks
the DSI node references acquired earlier. Release both optional DSI node
references before returning the bridge lookup error.

Fixes: 0c3997b0fec7 ("drm/bridge: lt9611: attach to the next bridge")
Signed-off-by: Zhiqi Zhang <[email protected]>
---
AI assistance disclosure: I found the bug. Codex modified the code.
I reviewed the change.

Build-tested with ARCH=arm64 allmodconfig object builds.
I did not test on hardware.

 drivers/gpu/drm/bridge/lontium-lt9611.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c 
b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 619ee6e95c..d5d8151d8e 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -1045,8 +1045,11 @@ static int lt9611_parse_dt(struct device *dev,
        lt9611->ac_mode = of_property_read_bool(dev->of_node, "lt,ac-mode");
 
        lt9611->bridge.next_bridge = 
of_drm_get_bridge_by_endpoint(dev->of_node, 2, -1);
-       if (IS_ERR(lt9611->bridge.next_bridge))
+       if (IS_ERR(lt9611->bridge.next_bridge)) {
+               of_node_put(lt9611->dsi1_node);
+               of_node_put(lt9611->dsi0_node);
                return PTR_ERR(lt9611->bridge.next_bridge);
+       }
 
        return 0;
 }
-- 
2.54.0 (Apple Git-157)

Reply via email to