video: fbdev: clcdfb: Fix refcount leak in clcdfb_of_vram_setup
authorMiaoqian Lin <linmq006@gmail.com>
Thu, 12 May 2022 11:59:08 +0000 (15:59 +0400)
committerHelge Deller <deller@gmx.de>
Thu, 19 May 2022 09:11:20 +0000 (11:11 +0200)
of_parse_phandle() returns a node pointer with refcount incremented, we should
use of_node_put() on it when not need anymore.  Add missing of_node_put() to
avoid refcount leak.

Fixes: d10715be03bd ("video: ARM CLCD: Add DT support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/amba-clcd.c

index 9ec969e136bfd6517e2590b539a5822a92fc2f7b..8080116aea844d5556a4b0f22cad92ce5a7f5d6e 100644 (file)
@@ -758,12 +758,15 @@ static int clcdfb_of_vram_setup(struct clcd_fb *fb)
                return -ENODEV;
 
        fb->fb.screen_base = of_iomap(memory, 0);
-       if (!fb->fb.screen_base)
+       if (!fb->fb.screen_base) {
+               of_node_put(memory);
                return -ENOMEM;
+       }
 
        fb->fb.fix.smem_start = of_translate_address(memory,
                        of_get_address(memory, 0, &size, NULL));
        fb->fb.fix.smem_len = size;
+       of_node_put(memory);
 
        return 0;
 }