Re: [patch] fix the softlockup watchdog to actually work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 17 Jul 2007 11:14:51 -0700 (PDT) Linus Torvalds wrote:

> On Tue, 17 Jul 2007, Randy Dunlap wrote:
> >
> > > +	if ((print_timestamp >= touch_timestamp &&
> > > +			print_timestamp < (touch_timestamp + 1)) ||
> > > +			did_panic || !per_cpu(watchdog_task, this_cpu)) {
> > >  		return;
> > > +	}
> > >  
> > >  	/* do not print during early bootup: */
> > >  	if (unlikely(system_state != SYSTEM_RUNNING)) {
> > 
> > patch contains unneeded braces { }.
> 
> When there are issues with indentation, those braces are actually not 
> unneeded any more, except for the compiler.
> 
> Just _look_ at the code. The indentation is not obvious, because the 
> if-conditional itself is multiple lines, and indented (arguably wrongly so 
> too, but that's another issue).

I strongly agree with your parenthetical remark and think that is
the real problem.


> So it's no longer a trivial one-liner statement, it's a "multi-statement" 
> spread out over multiple lines, and I think the braces are actually a good 
> idea for things like that.
> 
> I also encourage people do do braces when you have nested indentation, ie
> 
> 	if (something)
> 		if (somethingelse)
> 			return;

I think that this is wrong only when there is an "else" branch
following this.

> is actively *wrong*, while
> 
> 	if (something) {
> 		if (somethingelse)
> 			return;
> 	}
> 
> is right, even though the braces are "unnecessary". Again, it's about the 
> visual representation, not about whether the compiler needs them or not.

I agree with your last statement.
And thankfully none of this is in CodingStyle.  (oops)


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux