[PATCH] video: fbdev: Fix refcount leak bug in valkyriefb.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In valkyriefb_init(), of_find_node_by_name() will return a node pointer
with refcount incremented. We should use of_node_put() in fail path or
when it is not used anymore.

Signed-off-by: Liang He <windhl@xxxxxxx>
---
 drivers/video/fbdev/valkyriefb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/video/fbdev/valkyriefb.c b/drivers/video/fbdev/valkyriefb.c
index a6c9d4f26669..20d727a8069d 100644
--- a/drivers/video/fbdev/valkyriefb.c
+++ b/drivers/video/fbdev/valkyriefb.c
@@ -334,10 +334,13 @@ int __init valkyriefb_init(void)
 			return 0;
 
 		if (of_address_to_resource(dp, 0, &r)) {
+			of_node_put(dp);
 			printk(KERN_ERR "can't find address for valkyrie\n");
 			return 0;
 		}
 
+		of_node_put(dp);
+
 		frame_buffer_phys = r.start;
 		cmap_regs_phys = r.start + 0x304000;
 	}
-- 
2.25.1




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux