Commit 78be959e authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds

kstrtox: simpler code in _kstrtoull()

Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 01eda2e0
...@@ -49,12 +49,9 @@ static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res) ...@@ -49,12 +49,9 @@ static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)
val = *s - '0'; val = *s - '0';
else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f') else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f')
val = _tolower(*s) - 'a' + 10; val = _tolower(*s) - 'a' + 10;
else if (*s == '\n') { else if (*s == '\n' && *(s + 1) == '\0')
if (*(s + 1) == '\0') break;
break; else
else
return -EINVAL;
} else
return -EINVAL; return -EINVAL;
if (val >= base) if (val >= base)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment