]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/mm: Simplify loop control in parse_numa_properties()
authorReza Arbab <arbab@linux.vnet.ibm.com>
Thu, 13 Oct 2016 18:45:30 +0000 (13:45 -0500)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 30 Jan 2017 05:49:30 +0000 (16:49 +1100)
commit2f3a487b792a2700dc361d099e02f64a8843214a
tree233ee8de4b8a662aada9907f43ca58300ec298df
parent5ed477c4e9cb86b7c9343f918b8a6d8ffba0be6c
powerpc/mm: Simplify loop control in parse_numa_properties()

The flow of the main loop in parse_numa_properties() is overly
complicated. Simplify it to be less confusing and easier to read.
No functional change.

The end of the main loop in parse_numa_properties() looks like this:

for_each_node_by_type(...) {
...
if (!condition) {
if (--ranges)
goto new_range;
else
continue;
}

statement();

if (--ranges)
goto new_range;
/* else
 * continue; <- implicit, this is the end of the loop
 */
}

The only effect of !condition is to skip execution of statement(). This
can be rewritten in a simpler way:

for_each_node_by_type(...) {
...
if (condition)
statement();

if (--ranges)
goto new_range;
}

Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/numa.c