Re: [RFC][PATCH 14/18 v2] ftrace/lockdep: Have the RCU lockdep splatshow what function triggered

From: Ingo Molnar
Date: Fri Sep 06 2013 - 08:57:29 EST



* Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> On Thu, 5 Sep 2013 21:18:39 +0200
> Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> > On Sat, Aug 31, 2013 at 01:11:31AM -0400, Steven Rostedt wrote:
> > > +void print_ftrace_rcu_func(int cpu)
> > > +{
> > > + unsigned long ip = per_cpu(ftrace_rcu_func, cpu);
> > > +
> > > + if (ip)
> > > + printk("ftrace_rcu_func: %pS\n",
> > > + (void *)per_cpu(ftrace_rcu_func, cpu));
> > > +}
> >
> > That's missing { }.
>
> Hmm, that's an interesting point. Why the { } because I break up the
> printk for the 80 character limit?

You probably shouldn't break it up - it looks uglier.

> Although, I'm still not convinced that it needs { }, as it looks to me
> that it flows nicely without it. I can't find a place in CodingStyle
> that says { } are needed here.

it's somewhat of a grey area - the section quoted below talks about it
broadly - and it's typically understood to apply to multi-line statements
as well, as it's easy to overlook and confuse multi-statements with
multi-line statements...

Thanks,

Ingo

----------------------->

Do not unnecessarily use braces where a single statement will do.

if (condition)
action();

and

if (condition)
do_this();
else
do_that();

This does not apply if only one branch of a conditional statement is a
single statement; in the latter case use braces in both branches:

if (condition) {
do_this();
do_that();
} else {
otherwise();
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/