Skip to contentSkip to conversation

fix of_flat_dt_is_compatible to match the full compatible string

PATCH In review Stuart Yoder 2 participants 2 messages Jul 23, 2010 – Jul 24, 2010 Device tree

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fix of_flat_dt_is_compatible to match the full compatible string

From: Stuart Yoder <[email protected]>

With the previous string comparison, a device tree compatible of "foo-bar" would match as compatible with a driver looking for "foo".

---
 drivers/of/fdt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/of/fdt.c +1 -1
index dee4fb5..28c0c2b 100644
@@ -169,7 +169,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
 	if (cp == NULL)
 		return 0;
 	while (cplen > 0) {
-		if (strncasecmp(cp, compat, strlen(compat)) == 0)
+		if (!strcasecmp(cp, compat))
 			return 1;
 		l = strlen(cp) + 1;
 		cp += l;
Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 7 lines · Stuart Yoder

From: Stuart Yoder <[email protected]>

With the previous string comparison, a device tree compatible of "foo-bar" would match as compatible with a driver looking for "foo".

Hi Stewart.

Patch looks good. I'll test it this afternoon.

However, please remember to cc: me and devicetree-discuss if you want patches picked up remotely quickly (I know, I'm slow anyway, but I'm even slower when I don't see something. I only came across this one by chance.)

g.

Quoted 25 lines

---
drivers/of/fdt.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
drivers/of/fdt.c +1 -1
index dee4fb5..28c0c2b 100644
@@ -169,7 +169,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
 	if (cp == NULL)
 		return 0;
 	while (cplen > 0) {
-		if (strncasecmp(cp, compat, strlen(compat)) == 0)
+		if (!strcasecmp(cp, compat))
 			return 1;
 		l = strlen(cp) + 1;
 		cp += l;
Signature · 7 lines
1.6.2.5


_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
Signature · 1 line
Sent from my Android phone with K-9 Mail. Please excuse my brevity.