浏览代码

Merge tag 'devicetree-fixes-for-4.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull DeviceTree fixes from Rob Herring:

 - Fix memory leak in error case of of_console_check

 - Increase number of reserved memory regions to 32. 16 was not enough
   on some Power systems.

 - Fix OF node refcounting for of_fwnode_graph_get_port_parent

* tag 'devicetree-fixes-for-4.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
  device property: preserve usecount for node passed to of_fwnode_graph_get_port_parent()
  drivers: of: increase MAX_RESERVED_REGIONS to 32
  of: do not leak console options
Linus Torvalds 7 年之前
父节点
当前提交
0c080ceee7
共有 3 个文件被更改,包括 8 次插入4 次删除
  1. 6 2
      drivers/of/base.c
  2. 1 1
      drivers/of/of_reserved_mem.c
  3. 1 1
      drivers/of/property.c

+ 6 - 2
drivers/of/base.c

@@ -1781,8 +1781,12 @@ bool of_console_check(struct device_node *dn, char *name, int index)
 {
 {
 	if (!dn || dn != of_stdout || console_set_on_cmdline)
 	if (!dn || dn != of_stdout || console_set_on_cmdline)
 		return false;
 		return false;
-	return !add_preferred_console(name, index,
-				      kstrdup(of_stdout_options, GFP_KERNEL));
+
+	/*
+	 * XXX: cast `options' to char pointer to suppress complication
+	 * warnings: printk, UART and console drivers expect char pointer.
+	 */
+	return !add_preferred_console(name, index, (char *)of_stdout_options);
 }
 }
 EXPORT_SYMBOL_GPL(of_console_check);
 EXPORT_SYMBOL_GPL(of_console_check);
 
 

+ 1 - 1
drivers/of/of_reserved_mem.c

@@ -25,7 +25,7 @@
 #include <linux/sort.h>
 #include <linux/sort.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 
 
-#define MAX_RESERVED_REGIONS	16
+#define MAX_RESERVED_REGIONS	32
 static struct reserved_mem reserved_mem[MAX_RESERVED_REGIONS];
 static struct reserved_mem reserved_mem[MAX_RESERVED_REGIONS];
 static int reserved_mem_count;
 static int reserved_mem_count;
 
 

+ 1 - 1
drivers/of/property.c

@@ -954,7 +954,7 @@ of_fwnode_graph_get_port_parent(struct fwnode_handle *fwnode)
 	struct device_node *np;
 	struct device_node *np;
 
 
 	/* Get the parent of the port */
 	/* Get the parent of the port */
-	np = of_get_next_parent(to_of_node(fwnode));
+	np = of_get_parent(to_of_node(fwnode));
 	if (!np)
 	if (!np)
 		return NULL;
 		return NULL;