From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mx53loco: Remove unneeded 'retval' variable
Date: Thu, 27 Dec 2012 20:14:32 +0100 [thread overview]
Message-ID: <20121227191432.778A3200622@gemini.denx.de> (raw)
In-Reply-To: <50DC2B8F.2030709@denx.de>
Dear Stefano,
In message <50DC2B8F.2030709@denx.de> you wrote:
>
> I think it relies on the fact that only one of the two PMICs is mounted
> on the board. There are versions of the board with the Dialog PMIC, and
> other versions with Frescale's. Worse it is, there is no easy way to
> detect which version of the board is running.
The code should be fixed anyway - it is trivial to rewrite such that
there are no problems even if both branches would be executed.
Please note that the test is a plain i2c_probe(), so any other I2C
device you may attach to such a board can cause a false positive here.
Thinking again about this, the approach of using i2c_probe() is kind
of questionable.
> However, only one of the two branch can run, because i2c_probe() fails
> if the PMIC is not found.
Who guarantees that no other I2C device has been attached that uses
the "free" address?
> Agree, but physically not possible, until Freescale decides to mount
> both PMICs on the mx53loco...(but this is a nonsense)
The needed change is small, and defensive programming has always been
a good idea. Please let's have this fixed.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Here's a fish hangs in the net like a poor man's right in the law.
'Twill hardly come out." - Shakespeare, Pericles, Act II, Scene 1
next prev parent reply other threads:[~2012-12-27 19:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-27 10:26 [U-Boot] [PATCH] mx53loco: Remove unneeded 'retval' variable Fabio Estevam
2012-12-27 10:35 ` Wolfgang Denk
2012-12-27 11:05 ` Stefano Babic
2012-12-27 11:14 ` Fabio Estevam
2012-12-27 19:27 ` Wolfgang Denk
2012-12-27 19:14 ` Wolfgang Denk [this message]
2012-12-28 8:18 ` Stefano Babic
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=20121227191432.778A3200622@gemini.denx.de \
--to=wd@denx.de \
--cc=u-boot@lists.denx.de \
/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