diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2011-04-14 15:22:02 -0700 |
---|---|---|
committer | said m bagheri <ebgheri@steludxu2848.(none)> | 2011-06-29 10:30:29 +0200 |
commit | 49a6cf160acc5a7be0c479c503a554a5c1035739 (patch) | |
tree | b7633325f1fed150daa22ecc040edfb16fc19860 /lib | |
parent | 69089ef0e5f86dc6df052e57862ff2cb3c8e854c (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>
Change-Id: Ifbc44b6f1eb3ce144956bc5a3917f7a0651a764b
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/25237
Tested-by: Jonas ABERG <jonas.aberg@stericsson.com>
Reviewed-by: QATEST
Reviewed-by: Linus WALLEIJ <linus.walleij@stericsson.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kstrtox.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/kstrtox.c b/lib/kstrtox.c index 05672e819f8..a235f3cc471 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) 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) |