]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
Merge tag 'devicetree-fixes-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 19 May 2017 22:03:24 +0000 (15:03 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 19 May 2017 22:03:24 +0000 (15:03 -0700)
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"

1  2 
drivers/of/fdt.c

diff --combined drivers/of/fdt.c
index 3080d9dd031d14f27553b8596dc4d2dc0248bdfa,0373ae49d24dc43f491822ceedc7f8c5c1da45f3..43bd69dceabfd36b43368366b8afdc9fa2b30106
@@@ -507,6 -507,9 +507,9 @@@ void *__unflatten_device_tree(const voi
  
        /* 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);
@@@ -755,36 -758,6 +758,36 @@@ int __init of_scan_flat_dt(int (*it)(un
        return rc;
  }
  
 +/**
 + * of_scan_flat_dt_subnodes - scan sub-nodes of a node call callback on each.
 + * @it: callback function
 + * @data: context data pointer
 + *
 + * This function is used to scan sub-nodes of a node.
 + */
 +int __init of_scan_flat_dt_subnodes(unsigned long parent,
 +                                  int (*it)(unsigned long node,
 +                                            const char *uname,
 +                                            void *data),
 +                                  void *data)
 +{
 +      const void *blob = initial_boot_params;
 +      int node;
 +
 +      fdt_for_each_subnode(node, blob, parent) {
 +              const char *pathp;
 +              int rc;
 +
 +              pathp = fdt_get_name(blob, node, NULL);
 +              if (*pathp == '/')
 +                      pathp = kbasename(pathp);
 +              rc = it(node, pathp, data);
 +              if (rc)
 +                      return rc;
 +      }
 +      return 0;
 +}
 +
  /**
   * of_get_flat_dt_subnode_by_name - get the subnode by given name
   *
@@@ -844,14 -817,6 +847,14 @@@ int __init of_flat_dt_match(unsigned lo
        return of_fdt_match(initial_boot_params, node, compat);
  }
  
 +/**
 + * of_get_flat_dt_prop - Given a node in the flat blob, return the phandle
 + */
 +uint32_t __init of_get_flat_dt_phandle(unsigned long node)
 +{
 +      return fdt_get_phandle(initial_boot_params, node);
 +}
 +
  struct fdt_scan_status {
        const char *name;
        int namelen;