[U-Boot] [PATCH] mx53loco: Remove unneeded 'retval' variable
Wolfgang Denk
wd at denx.de
Thu Dec 27 20:14:32 CET 2012
Dear Stefano,
In message <50DC2B8F.2030709 at 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
More information about the U-Boot
mailing list