DeviceTree fixes for 4.12-rc:

- Fix missing allocation failure handling in fdt code
 
 - Fix dtc compile error on 32-bit hosts
 
 - Revert bad sparse changes causing GCC7 warnings
 -----BEGIN PGP SIGNATURE-----
 
 iQItBAABCAAXBQJZHlHSEBxyb2JoQGtlcm5lbC5vcmcACgkQ+vtdtY28YcODVg//
 VKaZS1fHHaFyUvtKATqeukm7tQsX1a9l1XMBZVmFgN/elT9UeFRKimRLCoPY6x7Y
 VwDq/upxmasROm9/HJGx6AyCE4jzHfeOKhi8I82LT06+ZMbj5Z6Ip1uFQ7cLpSRi
 a+RN2EXIBYi64g8vS/KGlLNdQ+lWEZCKL4WqfnqrEHgEA30Hur8LNq7ugtZ8As0t
 QlgQOy6KrNxS2JGv/R5dwud0bK8YX2x5VeLKlvWTot7GFVevIWrMjd4/rmB9pCNs
 a17tSw8DMR/Z0HicVCg40QIWEaDw9rZLxt0m692D/53y7zDH1KwDov62b9BSjMQl
 u3D1qC0gWjn+8pArU9P+AoLAL8Jy5wLd7CzFSVqCQmWJWqgkkgCAX67fsnsNHmHF
 DDXJyA+Fw/ZLOFMBHNBUTiLHoPhxa4D/2K2WcBdVJQpvnoy/11rjH17BUwOloGWy
 Q9qKWQ1q5zYSrk7jjMae9akv3Q61ZEbnE0VNXPeh2ZkRBqBl/0c5yhscg+dR9KIf
 5RkbqfYcSMfqMvSCEZGmDDSAVraqjrURyWtcRHHbQM6GSdEn+szBxOTllGOHoiFc
 BoIRP0YSm+pRReWPgpv3aWl9eXTFDijbTkzursgHrdMf5H9ar4ndCLh9ZdVR5qyx
 JzYY008v1G2VaSupvhbqVcyEhJNJEHLcGrixg+CobCQ=
 =HlJN
 -----END PGP SIGNATURE-----

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

Pull DeviceTree fixes from Rob Herring:

 - fix missing allocation failure handling in fdt code

 - fix dtc compile error on 32-bit hosts

 - revert bad sparse changes causing GCC7 warnings

* tag 'devicetree-fixes-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
  of: fdt: add missing allocation-failure check
  dtc: check.c fix compile error
  Partially Revert "of: fix sparse warnings in fdt, irq, reserved mem, and resolver code"
This commit is contained in:
Linus Torvalds 2017-05-19 15:03:24 -07:00
commit 1fbbed4137
4 changed files with 6 additions and 3 deletions

View File

@ -507,6 +507,9 @@ void *__unflatten_device_tree(const void *blob,
/* Allocate memory for the expanded device tree */
mem = dt_alloc(size + 4, __alignof__(struct device_node));
if (!mem)
return NULL;
memset(mem, 0, size);
*(__be32 *)(mem + size) = cpu_to_be32(0xdeadbeef);

View File

@ -197,7 +197,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
const struct of_device_id *i;
for (i = __reservedmem_of_table; i < &__rmem_of_table_sentinel; i++) {
int const (*initfn)(struct reserved_mem *rmem) = i->data;
reservedmem_of_init_fn initfn = i->data;
const char *compat = i->compatible;
if (!of_flat_dt_is_compatible(rmem->fdt_node, compat))

View File

@ -8,7 +8,7 @@
#include <linux/ioport.h>
#include <linux/of.h>
typedef int const (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
/*
* Workarounds only applied to 32bit powermac machines

View File

@ -873,7 +873,7 @@ static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct no
while (size--)
reg = (reg << 32) | fdt32_to_cpu(*(cells++));
snprintf(unit_addr, sizeof(unit_addr), "%lx", reg);
snprintf(unit_addr, sizeof(unit_addr), "%zx", reg);
if (!streq(unitname, unit_addr))
FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"",
node->fullpath, unit_addr);