Watch
1
Fork
You've already forked kernel_a52xq
0
mirror of https://github.com/a52xq-dev/kernel.git synced 2026-10-18 21:58:11 +07:00

proc: use do-while in name_to_int()

Gcc doesn't know that "len" is guaranteed to be >=1 by dcache and
generates standard while-loop prologue duplicating loop condition.

	add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-27 (-27)
	function                                     old     new   delta
	name_to_int                                  104      77     -27

Link: http://lkml.kernel.org/r/20170912195213.GB17730@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>
This commit is contained in:
Alexey Dobriyan 2017-11-17 15:26:52 -08:00 • committed by Linus Torvalds
commit 0746a0bc6e

View file

@ -8,7 +8,7 @@ unsigned name_to_int(const struct qstr *qstr)
if (len > 1 && *name == '0')
goto out;
while (len-- > 0) {
do {
unsigned c = *name++ - '0';
if (c > 9)
goto out;
@ -16,7 +16,7 @@ unsigned name_to_int(const struct qstr *qstr)
goto out;
n *= 10;
n += c;
}
} while (--len > 0);
return n;
out:
return ~0U;