From: Qingshuang Fu <[email protected]>

for_each_child_of_node() holds a reference to layer_node for the
duration of each iteration and only releases the previous node when
advancing to the next one.  When logicvc_layer_init() fails, the loop
exits via the error label without ever advancing, so the reference to
layer_node is never dropped and the device node leaks.  Add the missing
of_node_put() on the error path.

Fixes: efeeaefe9be5 ("drm: Add support for the LogiCVC display controller")
Signed-off-by: Qingshuang Fu <[email protected]>
---
 drivers/gpu/drm/logicvc/logicvc_layer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/logicvc/logicvc_layer.c 
b/drivers/gpu/drm/logicvc/logicvc_layer.c
index 7f5ba000188a..e83a2aafed77 100644
--- a/drivers/gpu/drm/logicvc/logicvc_layer.c
+++ b/drivers/gpu/drm/logicvc/logicvc_layer.c
@@ -613,6 +613,7 @@ int logicvc_layers_init(struct logicvc_drm *logicvc)
 
                ret = logicvc_layer_init(logicvc, layer_node, index);
                if (ret) {
+                       of_node_put(layer_node);
                        of_node_put(layers_node);
                        goto error;
                }

base-commit: 45c13f3f9e3bb15fd89ff2864c6f627a3b4b4229
-- 
2.25.1

Reply via email to