Re: [3/6] kgdb: core

From: Ingo Molnar
Date: Sun Feb 10 2008 - 11:43:55 EST



* Marcin Slusarz <marcin.slusarz@xxxxxxxxx> wrote:

> > + if (CACHE_FLUSH_IS_SAFE) {
> > + if (current->mm && addr < TASK_SIZE) {
> > + flush_cache_range(current->mm->mmap_cache,
> > + addr, addr + BREAK_INSTR_SIZE);
> > + } else {
> > + flush_icache_range(addr, addr +
> > + BREAK_INSTR_SIZE);
> > + }
> > + }
> unneeded braces (here and in many other places)

this is a small detail, but you are wrong. These braces around
multi-line statements are unneded _for the compiler_, but are very much
wanted by humans. You'll see akpm, me and others reject/fix patches on a
routine basis that make this cleanliness mistake. Please watch out for
this when writing patches ;-)

> if ()
> else if ()
> else
>
> will look better

nope. I consciously avoid that construct because it's dangerous: it can
quite easily result in the wrong logic. Having _more_ braces than needed
by the compiler is a style error in only a single, special case.

> > + if (*(ptr++) != ',') {
> > + error_packet(remcom_out_buffer, -EINVAL);
> > + return;
> > + } else {
> no else needed

agreed - fixed.

> if (!kgdb_hex2long()) {
> error_packet();
> return;
> }

fixed.

Ingo
--
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/