Browse Source

Bugfix for CHECK_HAVE_WARN_PHANDLE()

At present, the tree checking code in dtc will die with an assertion
failure if given a tree which has the invalid value 0 or -1 in a
property which should contain a phandle.  This patch fixes the check
to die more gracefully with an error message indicating the invalid
phandle value.

Signed-off-by: David Gibson <dwg@au1.ibm.com>
main
David Gibson 18 years ago committed by Jon Loeliger
parent
commit
54382390e4
  1. 5
      livetree.c

5
livetree.c

@ -427,10 +427,15 @@ static int check_structure(struct node *tree) @@ -427,10 +427,15 @@ static int check_structure(struct node *tree)
struct node *ref; \
CHECK_HAVE_WARN_ONECELL((xnode), (propname)); \
if (prop) {\
cell_t phandle = propval_cell(prop); \
if ((phandle == 0) || (phandle == -1)) { \
DO_ERR("\"%s\" property in %s contains an invalid phandle %x\n", (propname), (xnode)->fullpath, phandle); \
} else { \
ref = get_node_by_phandle((root), propval_cell(prop)); \
if (! ref) \
DO_ERR("\"%s\" property in %s refers to non-existant phandle %x\n", (propname), (xnode)->fullpath, propval_cell(prop)); \
} \
} \
} while (0)

#define CHECK_HAVE_WARN_STRING(node, propname) \

Loading…
Cancel
Save