[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.0812161231500.14014@localhost.localdomain>
Date: Tue, 16 Dec 2008 12:35:25 -0800 (PST)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Joe Perches <joe@...ches.com>
cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Brice Goglin <Brice.Goglin@...ia.fr>,
Christoph Lameter <clameter@....com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Nick Piggin <npiggin@...e.de>, Hugh Dickins <hugh@...itas.com>
Subject: Re: mm: Don't touch uninitialized variable in
do_pages_stat_array()
On Tue, 16 Dec 2008, Joe Perches wrote:
>
> Perhaps this is more legible and avoids
> the unnecessary assignments to err.
Not only is it less legible to me, but the "unnecessary" assignments are
the ones that make the flow control much simpler.
I think it's a _lot_ easier to read
retval = BADNESS;
if (something bad)
goto out;
than it is to make the insides of the conditional more complex. It also
tends to generate better code, although gcc's code movement often makes it
not matter (and equally often makes a mess of it). That's because a
if (something)
goto somewhere;
is actually how the CPU itself ends up executing things, while a
if (something) {
retval = something;
goto somewhere;
}
actually ends up becoming
if (!someting)
goto over;
retval = something;
goto somewhere;
over:
by the time the CPU actually has to execute it.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists