Skip to contentSkip to conversation

xen/arm: use strcmp in device_tree_type_matches

PATCH In review Stefano Stabellini 2 participants 2 messages Dec 5, 2012 – Dec 6, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 xen/arm: use strcmp in device_tree_type_matches

We want to match the exact string rather than the first subset.

---
 xen/common/device_tree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
xen/common/device_tree.c +1 -1
index b321d99..3d4a7a9 100644
@@ -51,7 +51,7 @@ bool_t device_tree_type_matches(const void *fdt, int node, const char *match)
     if ( prop == NULL )
         return 0;
 
-    return !strncmp(prop, match, len);
+    return !strcmp(prop, match);
 }
 
 bool_t device_tree_node_compatible(const void *fdt, int node, const char *match)
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 12 lines · Stefano Stabellini

We want to match the exact string rather than the first subset.

---
 xen/common/device_tree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
xen/common/device_tree.c +0 -0
index b321d99..3d4a7a9 100644

xen/common/device_tree.c bool_t device_tree_type_matches(const void *fdt, int node, const char *match) · line 54

Quoted 5 lines
xen/common/device_tree.c +1 -1
@@ -51,7 +51,7 @@ bool_t device_tree_type_matches(const void *fdt, int node, const char *match)
     if ( prop == NULL )
         return 0;
 
-    return !strncmp(prop, match, len);
+    return !strcmp(prop, match);

fdt_getprop handled lenp == NULL so you can actually get rid of len completely.

Quoted 3 lines
xen/common/device_tree.c +0 -0
 }
 
 bool_t device_tree_node_compatible(const void *fdt, int node, const char *match)