[RESEND PATCH 4.0-rc5 v19 5/6] x86/nmi: Use common printk functions

Borislav Petkov bp at alien8.de
Tue Apr 7 09:37:46 PDT 2015


On Tue, Apr 07, 2015 at 12:19:42PM -0400, Steven Rostedt wrote:
> Not sure what the others think, but I hate this polish notation for
> compares. One does not say "if zero does not equal
> printk_nmi_backtrace_prepare()", they say "if
> printk_nmi_backtrace_prepare() does not return zero".
> 
> And the reason for polish notation is to prevent the:
> 
> 	if (x = 0)
> 
> mistake. Which gcc warns about anyway. Also, this doesn't even pertain
> to this code because:
> 
> 	if (printk_nmi_backtrace_prepare() = 0)
> 
> would fail to compile.

I would simply say:

	err = printk_nmi_backtrace_prepare();
	if (err)

like sane kernel code does.

Besides, there's not a lot of such comparisons in the kernel anyway:

$ git grep -E "if\s+\(+[0-9]+\!?=.*"
drivers/ide/au1xxx-ide.c:246:                   if (1==i)

but my regex doesn't cover all possible variants, just the single-line
ones.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--



More information about the linux-arm-kernel mailing list