[U-Boot] exit(-1) function in U-Boot

Wolfgang Denk wd at denx.de
Tue Mar 17 18:08:23 CET 2009


Dear Drasko DRASKOVIC,

In message <5ec3d7930903170638n7769e61anb30f5ce39d704f84 at mail.gmail.com> you wrote:
>
> I am sorry for being  vague, I hope this example will make it a bit more
> clear:
> 
> static void
> TftpTimeout (void)
> {
>     if (++TftpTimeoutCount > TIMEOUT_COUNT) {
>         puts ("\nRetry count exceeded; timeout error\n");
>         if (image_valid == 0)
>         {
>             /*
>              * We have no valid Linux image anymore!
>              * We must start update again!
>              */
>              NetStartAgain ();
>         }
>        * else /* last image is not corrupted, I want to boot it */
>         {
>              /* LET ME OUT! I do not want to go back to net.c caller,
> bacause I do not know how to tell him it was TIMEOUT.
>                  All I can do is NetState = NETLOOP_FAIL. Not much of an
> info. */
>             printf("TIMEOUT error\n");
>             exit (-1);
>         }*
>     } else {
>         puts ("T ");
>         NetSetTimeout (TIMEOUT * CFG_HZ, TftpTimeout);
>         TftpSend ();
>     }
> }

What you are doing here makes no sense.

Image handling has no place in the networking code.

If you need image download with error handling, then implement this on
the command level as a command sequence in an environment variable, or
as a shell script.

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
God is real, unless declared integer.


More information about the U-Boot mailing list