lib/kstrtox.c: delete end-of-string test
authorAlexey Dobriyan <adobriyan@gmail.com>
Mon, 10 Jul 2017 22:51:38 +0000 (15:51 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 10 Jul 2017 23:32:34 +0000 (16:32 -0700)
Standard "while (*s)" test is unnecessary because NUL won't pass
valid-digit test anyway.  Save one branch per parsed character.

Link: http://lkml.kernel.org/r/20170514193756.GA32563@avx2
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>
lib/kstrtox.c

index bf85e05ce85815a0fb36ab26f9e5642dd455ae1a..90013f4841c77b35935009d313363e2e7b02c0d7 100644 (file)
@@ -51,7 +51,7 @@ unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long
 
        res = 0;
        rv = 0;
-       while (*s) {
+       while (1) {
                unsigned int val;
 
                if ('0' <= *s && *s <= '9')