aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2011-04-14 18:22:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-04-14 19:06:55 -0400
commit78be959e38567f0e020848179a5d64d2b064391a (patch)
tree2b6b42edb8ba4f717db5d7a140c77d4993934f0d /lib
parent01eda2e0c0cf035308308a19581e4979285b51ec (diff)
kstrtox: simpler code in _kstrtoull()
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/kstrtox.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/kstrtox.c b/lib/kstrtox.c
index 05672e819f8c..a235f3cc471c 100644
--- a/lib/kstrtox.c
+++ b/lib/kstrtox.c
@@ -49,12 +49,9 @@ static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)
49 val = *s - '0'; 49 val = *s - '0';
50 else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f') 50 else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f')
51 val = _tolower(*s) - 'a' + 10; 51 val = _tolower(*s) - 'a' + 10;
52 else if (*s == '\n') { 52 else if (*s == '\n' && *(s + 1) == '\0')
53 if (*(s + 1) == '\0') 53 break;
54 break; 54 else
55 else
56 return -EINVAL;
57 } else
58 return -EINVAL; 55 return -EINVAL;
59 56
60 if (val >= base) 57 if (val >= base)