Skip to content

Commit

Permalink
kstrtox: simpler code in _kstrtoull()
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Dobriyan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Alexey Dobriyan authored and torvalds committed Apr 14, 2011
1 parent 01eda2e commit 78be959
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/kstrtox.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,9 @@ static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)
val = *s - '0';
else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f')
val = _tolower(*s) - 'a' + 10;
else if (*s == '\n') {
if (*(s + 1) == '\0')
break;
else
return -EINVAL;
} else
else if (*s == '\n' && *(s + 1) == '\0')
break;
else
return -EINVAL;

if (val >= base)
Expand Down

0 comments on commit 78be959

Please sign in to comment.