DeviceTree fixes for 4.14:

- 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
 -----BEGIN PGP SIGNATURE-----
 
 iQItBAABCAAXBQJZ37DnEBxyb2JoQGtlcm5lbC5vcmcACgkQ+vtdtY28YcPMvxAA
 rmzCNgX5Wyh8l4Oe+dg3J641J7ggWD4dGbYejsk+fGADg+4HB57RWytVNjUa59kH
 97uyawizUdLh+w0kfGfajDWhkMu8+D9+4a5OVkUGFTCVjR6FChc/r62IxL/D+KaU
 EqMiKILZGgT0pwb6DFbQPQt3tPpH//iKvOUSgrMVr1ouM86nkSJPcYdmVNh8i90q
 l5UFDqrP1DDkB3pXV8OZF4oa9wncLg8sd9AL62sFHlMM5J+Q2Gtg6oM8yh3x3OCU
 imKdYZ2re7FZuXpzuifV8U3SGkYdlJX8QodAZxFHObgtTZLK5GVi4oj2uLUs62o0
 4dp4fKQc4ZfCnQ+hLAShta49e+Sjl/5s/Y7byI4IQrPvOEkVMVrfi+eQ5D7NSHVf
 cyLGfzpHQ8qXGC03zI6ZW+KAlEpZC8ZegiHeuTVW73tEew437TUICYKf4VBJxilu
 V4ToyyirPFzCB9NDJeOpITYIbUgGwCpcIcar80XCcZdDd5BKByY3AC4wSCLRQrwj
 /5WnWlAR1aFfAC0AYp+j8L91Ok6xqTLW5ZEgjEQGBaA4+zVfEHNlJ970CBRQf8UP
 9Xe+g8na543dXX1+b/E9ii3TW7uG5vtUGIN3cWcK0zWfs1DSB+2yoPDwhbi7oOPE
 sX/OKm/AqkD9nkyvTVYq976nA8vrfS4gYau/zhhWz+o=
 =LVMp
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2017-10-13 11:44:09 -07:00
commit 0c080ceee7
3 changed files with 8 additions and 4 deletions

View File

@ -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)
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);

View File

@ -25,7 +25,7 @@
#include <linux/sort.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 int reserved_mem_count;

View File

@ -954,7 +954,7 @@ of_fwnode_graph_get_port_parent(struct fwnode_handle *fwnode)
struct device_node *np;
/* 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)
return NULL;