Skip to contentSkip to conversation

video: valkyriefb: Fix reference count leak in valkyriefb_init

PATCH Applied Miaoqian Lin 2 participants 2 messages Oct 27, 2025 – Oct 28, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: valkyriefb: Fix reference count leak in valkyriefb_init

The of_find_node_by_name() function returns a device tree node with its reference count incremented. The caller is responsible for calling of_node_put() to release this reference when done.

Found via static analysis.

Fixes cc5d0189b9ba ("[PATCH] powerpc: Remove device_node addrs/n_addr")
---
 drivers/video/fbdev/valkyriefb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/video/fbdev/valkyriefb.c +2 -0
index 91d070ef6989..6ff059ee1694 100644
@@ -329,11 +329,13 @@ static int __init valkyriefb_init(void)
 
 		if (of_address_to_resource(dp, 0, &r)) {
 			printk(KERN_ERR "can't find address for valkyrie\n");
+			of_node_put(dp);
 			return 0;
 		}
 
 		frame_buffer_phys = r.start;
 		cmap_regs_phys = r.start + 0x304000;
+		of_node_put(dp);
 	}
 #endif /* ppc (!CONFIG_MAC) */
 
Signature · 1 line
2.39.5 (Apple Git-154)
maintainer Applied
#1 lore raw
Quoted 4 lines · Miaoqian Lin

The of_find_node_by_name() function returns a device tree node with its reference count incremented. The caller is responsible for calling of_node_put() to release this reference when done.

Quoted 8 lines

Found via static analysis.

Fixes cc5d0189b9ba ("[PATCH] powerpc: Remove device_node addrs/n_addr")
---
  drivers/video/fbdev/valkyriefb.c | 2 ++
  1 file changed, 2 insertions(+)

applied.

Thanks!
Helge