[U-Boot-Users] [PATCH libfdt 3/3] More clean up of cmd_bootm.c

Wolfgang Denk wd at denx.de
Wed May 30 09:03:08 CEST 2007


In message <465CD759.9090303 at gmail.com> you wrote:
>
> Question for Wolfgang D:
> 
> It looks like the error messages originally only used puts() and, I 
> would speculate, printf()s were added later.  I'm deducing this from the 
> original, the CONFIG_BZIP2 addition does a printf() on the error:

The general rule is to use puts() for printing constant strings without
formatting.

>   370                         printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);

Here we have the "%d", thus we need printf().

> Is printf() safe in this delicate condition?  Should I strip all 

It's not safe in the sense that I would rely my life on it.  It's  an
attempt  to get the error message out and may or may not work. puts()
requires a little less code so it is a little more  likely  to  work,
but that doesn't make much of a difference.

> Should I strip out the udelay()s too?  As you pointed out previously, 
> udelay() is not safe on some boards that use interrupts to measure the 
> delay.

Yes, please do - especially as I see no reason what the udelay() could
be useful for.

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
Man is the best computer we can put aboard a spacecraft ...  and  the
only one that can be mass produced with unskilled labor.
                                                  - Wernher von Braun




More information about the U-Boot mailing list