summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFrank Rowand <frank.rowand@sony.com>2018-10-04 20:32:04 -0700
committerFrank Rowand <frank.rowand@sony.com>2018-11-08 22:11:32 -0800
commit6f75118800acf77f8ad6afec61ca1b2349ade371 (patch)
treec8c46a2f76a8ae4cab60f79ad6575deef7334787 /include
parent81225ea682f45629a66309636482b7c9bc2dcec1 (diff)
of: overlay: validate overlay properties #address-cells and #size-cells
If overlay properties #address-cells or #size-cells are already in the live devicetree for any given node, then the values in the overlay must match the values in the live tree. If the properties are already in the live tree then there is no need to create a changeset entry to add them since they must have the same value. This reduces the memory used by the changeset and eliminates a possible memory leak. Tested-by: Alan Tull <atull@kernel.org> Signed-off-by: Frank Rowand <frank.rowand@sony.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/of.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index 664cd5573ae2..18ac8921e90c 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -990,6 +990,12 @@ static inline int of_map_rid(struct device_node *np, u32 rid,
#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
#endif
+static inline int of_prop_val_eq(struct property *p1, struct property *p2)
+{
+ return p1->length == p2->length &&
+ !memcmp(p1->value, p2->value, (size_t)p1->length);
+}
+
#if defined(CONFIG_OF) && defined(CONFIG_NUMA)
extern int of_node_to_nid(struct device_node *np);
#else