From: "Lothar Waßmann" <LW@KARO-electronics.de>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] devicetree: pull evaluation of of_address_to_resource() out of loop in of_dev_lookup()
Date: Wed, 4 Apr 2012 07:57:10 +0200 [thread overview]
Message-ID: <20347.58038.604528.388765@ipc1.ka-ro> (raw)
In-Reply-To: <20120403235434.A536C3E03F3@localhost>
Hi,
Grant Likely writes:
> On Tue, 3 Apr 2012 14:48:28 +0200, Lothar Waßmann <LW@KARO-electronics.de> wrote:
> > The result of_address_to_resource(np, 0, &res) is independent from the
> > for (; lookup->compatible != NULL; lookup++) {
> > }
> > loop evaluation. Evaluate it once before entering the loop.
> >
> > Also add a space between 'for' keyword and parens.
> >
> > Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
> > ---
>
> What is the reason for this patch? The error path may be slightly
> less efficient in the failure case, but it isn't incorrect.
>
What's not correct? If of_address_to_resource() yields a non-zero
result, the function will never reach the 'return lookup' inside the
loop but only the 'return NULL' at the end of the function. Thus it is
vain to re-evaluate of_address_to_resource() in every loop.
Lothar Waßmann
--
___________________________________________________________
Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996
www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________
prev parent reply other threads:[~2012-04-04 5:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-03 12:48 Lothar Waßmann
[not found] ` <20120403235434.A536C3E03F3@localhost>
2012-04-04 5:57 ` Lothar Waßmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20347.58038.604528.388765@ipc1.ka-ro \
--to=lw@karo-electronics.de \
--cc=grant.likely@secretlab.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=rob.herring@calxeda.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®