Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1560941

Re: [PATCH 03/13] x86/microcode/AMD: Clean up find_equiv_id()

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH 03/13] x86/microcode/AMD: Clean up find_equiv_id()
Date 2017-01-17 20:10 +0100
Message-ID <t0HiO-2uu-31@gated-at.bofh.it> (permalink)
References <t0FTI-1vq-27@gated-at.bofh.it> <t0G3o-1zz-25@gated-at.bofh.it> <t0Gd4-1D8-33@gated-at.bofh.it> <t0GZr-295-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 03/13] x86/microcode/AMD: Clean up find_equiv_id() Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
  Re: [PATCH 03/13] x86/microcode/AMD: Clean up find_equiv_id() Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 19:00 +0100
    Re: [PATCH 03/13] x86/microcode/AMD: Clean up find_equiv_id() Borislav Petkov <bp@alien8.de> - 2017-01-17 19:50 +0100
      Re: [PATCH 03/13] x86/microcode/AMD: Clean up find_equiv_id() Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 20:10 +0100
        Re: [PATCH 03/13] x86/microcode/AMD: Clean up find_equiv_id() Borislav Petkov <bp@alien8.de> - 2017-01-18 00:20 +0100

csiph-web