lt9611uxc_parse_dt() obtains references to the primary and secondary
DSI remote nodes with of_graph_get_remote_node() and stores them in
dsi0_node and dsi1_node.  If the following lookup of the panel or
bridge with drm_of_find_panel_or_bridge() fails, lt9611uxc_probe()
returns without calling of_node_put() on the DSI nodes, leaking the
references taken by of_graph_get_remote_node().

The error paths further down in lt9611uxc_probe() already release both
nodes through the err_of_put label.  Route the device tree parsing
failure to that label as well so the node references are dropped on
that error path too.

Fixes: 0cbbd5b1a012 ("drm: bridge: add support for lontium LT9611UXC bridge")
Cc: [email protected]
Signed-off-by: Wentao Liang <[email protected]>
---
 drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c 
b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
index 11aab07d88df..16ca26212d78 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
@@ -765,7 +765,7 @@ static int lt9611uxc_probe(struct i2c_client *client)
        ret = lt9611uxc_parse_dt(dev, lt9611uxc);
        if (ret) {
                dev_err(dev, "failed to parse device tree\n");
-               return ret;
+               goto err_of_put;
        }
 
        ret = lt9611uxc_gpio_init(lt9611uxc);
-- 
2.34.1

Reply via email to