diff options
author | Rob Herring <robh@kernel.org> | 2017-12-12 16:46:28 -0600 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2017-12-13 21:28:11 +1100 |
commit | e671852042a77b15ec72ca908291c7d647e4fb01 (patch) | |
tree | 51a51400664e55ea3860aecc4e5114e21c5f371f | |
parent | d0c44ebe3f4265dab3c9797eda1dacc569a1e953 (diff) | |
download | device-tree-compiler-e671852042a77b15ec72ca908291c7d647e4fb01.tar.gz |
checks: add aliases node checks
Add checks for aliases node that all properties follow alias naming
convention and the values are a valid path.
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r-- | checks.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -636,6 +636,28 @@ static void check_names_is_string_list(struct check *c, struct dt_info *dti, } WARNING(names_is_string_list, check_names_is_string_list, NULL); +static void check_alias_paths(struct check *c, struct dt_info *dti, + struct node *node) +{ + struct property *prop; + + if (!streq(node->name, "aliases")) + return; + + for_each_property(node, prop) { + if (!prop->val.val || !get_node_by_path(dti->dt, prop->val.val)) { + FAIL(c, dti, "aliases property '%s' is not a valid node (%s)", + prop->name, prop->val.val); + continue; + } + if (strspn(prop->name, LOWERCASE DIGITS "-") != strlen(prop->name)) + FAIL(c, dti, "aliases property name '%s' is not valid", + prop->name); + + } +} +WARNING(alias_paths, check_alias_paths, NULL); + static void fixup_addr_size_cells(struct check *c, struct dt_info *dti, struct node *node) { @@ -1354,6 +1376,8 @@ static struct check *check_table[] = { &gpios_property, &interrupts_property, + &alias_paths, + &always_fail, }; |