From: Wolfgang Denk Date: Tue, 17 Mar 2009 18:08:23 +0100 Subject: [U-Boot] exit(-1) function in U-Boot In-Reply-To: <5ec3d7930903170638n7769e61anb30f5ce39d704f84@mail.gmail.com> References: <5ec3d7930903130339t592e64a8o5ace302e06976ea@mail.gmail.com> <20090313134955.E5483832E8B8@gemini.denx.de> <5ec3d7930903170318r76f4786fsdf61ec1e2c11a04c@mail.gmail.com> <20090317103310.3E9BC832C2FD@gemini.denx.de> <5ec3d7930903170549sf6337c9l292d9ebef0fdf87a@mail.gmail.com> <20090317130643.8B451832E8B7@gemini.denx.de> <5ec3d7930903170638n7769e61anb30f5ce39d704f84@mail.gmail.com> Message-ID: <20090317170823.3F2D8832E8B7@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Drasko DRASKOVIC, In message <5ec3d7930903170638n7769e61anb30f5ce39d704f84@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.