summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2013-01-20 15:41:44 +0400
committerChris Zankel <chris@zankel.net>2013-02-23 19:22:31 -0800
commitc5a285bb1b54e8b636cb522a9eb9c9ad232a23f8 (patch)
treec42131a0c16dda921d68c625083b830eb9958ca8
parentde73b6b1bd7480301c8e8fbe58184448b1757945 (diff)
downloadlinux-c5a285bb1b54e8b636cb522a9eb9c9ad232a23f8.tar.gz
linux-c5a285bb1b54e8b636cb522a9eb9c9ad232a23f8.tar.bz2
linux-c5a285bb1b54e8b636cb522a9eb9c9ad232a23f8.zip
xtensa: fix str[n]cmp return value
str[n]cmp functions return negative value if the first string is less than the second, positive value if the first string is greater than the second and zero if they are equal. This is important when these functions are used for sorting/binary search. With incorrect strcmp return value bsearch was always failing in the find_symbol_in_section making it impossible to load any module. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Chris Zankel <chris@zankel.net>
-rw-r--r--arch/xtensa/include/asm/string.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/xtensa/include/asm/string.h b/arch/xtensa/include/asm/string.h
index 405a8c49ff2c..8d5d9dfadb09 100644
--- a/arch/xtensa/include/asm/string.h
+++ b/arch/xtensa/include/asm/string.h
@@ -74,7 +74,7 @@ static inline int strcmp(const char *__cs, const char *__ct)
"beqz %2, 2f\n\t"
"beq %2, %3, 1b\n"
"2:\n\t"
- "sub %2, %3, %2"
+ "sub %2, %2, %3"
: "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&r" (__dummy)
: "0" (__cs), "1" (__ct));
@@ -99,7 +99,7 @@ static inline int strncmp(const char *__cs, const char *__ct, size_t __n)
"beqz %3, 2f\n\t"
"beq %2, %3, 1b\n"
"2:\n\t"
- "sub %2, %3, %2"
+ "sub %2, %2, %3"
: "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&r" (__dummy)
: "0" (__cs), "1" (__ct), "r" (__cs+__n));