lkml.org 
[lkml]   [2017]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 03/13] x86/microcode/AMD: Clean up find_equiv_id()
On Tue, 17 Jan 2017, Borislav Petkov wrote:
> + for (; equiv_table && equiv_table->installed_cpu; equiv_table++)
> + if (sig == equiv_table->installed_cpu)
> + return equiv_table->equiv_cpu;

This would be perfect if you just kept the braces around the for loop.

for (; cond; incr)
do_something();

parses perfectly fine as it matches the expectation of a single line statement
following the for().

for (; cond; incr)
if (othercond)
do_something();

not so much because we expect a single line statement due to the lack of a
opening brace after the for()

for (; cond; incr) {
if (othercond)
do_something();
}

That's how it parses best. The opening brace after the for() tells us: here
comes a multiline statement. And the inner if (othercond) w/o the opening
brace tells: here comes a single line statement.

Reading code/patches very much depends on patterns and structuring. If they
are consistent the reading flow is undisturbed.

Thanks,

tglx


\
 
 \ /
  Last update: 2017-01-17 20:04    [W:0.084 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site