While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths. 

Fix it by comparing the phandles of DT nodes after the node names match.

Signed-off-by: Aswath Govindraju <a-govindr...@ti.com>
---
 lib/fdtdec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 2015907dee7d..9e1bfe0b519e 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -478,6 +478,11 @@ int fdtdec_get_alias_seq(const void *blob, const char 
*base, int offset,
                slash = strrchr(prop, '/');
                if (strcmp(slash + 1, find_name))
                        continue;
+
+               if (fdt_get_phandle(blob, offset) !=
+                   fdt_get_phandle(blob, fdt_path_offset(blob, prop)))
+                       continue;
+
                val = trailing_strtol(name);
                if (val != -1) {
                        *seqp = val;
-- 
2.17.1

Reply via email to