of_graph_get_remote_node() returns a device node
with its reference count incremented. The caller is responsible for
releasing this reference when the node is no longer needed.

Add of_node_put(remote) to fix the reference leak.

Found via static analysis.

Fixes: c70087e8f16f ("drm/drm_of: add drm_of_panel_bridge_remove function")
Cc: [email protected]
Signed-off-by: Miaoqian Lin <[email protected]>
---
 include/drm/drm_of.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
index 7f0256dae3f1..5940b1cd542b 100644
--- a/include/drm/drm_of.h
+++ b/include/drm/drm_of.h
@@ -171,6 +171,7 @@ static inline int drm_of_panel_bridge_remove(const struct 
device_node *np,
                return -ENODEV;
 
        bridge = of_drm_find_bridge(remote);
+       of_node_put(remote);
        drm_panel_bridge_remove(bridge);
 
        return 0;
-- 
2.39.5 (Apple Git-154)

Reply via email to