From: Wolfgang Denk Date: Wed, 03 Sep 2008 15:23:31 +0200 Subject: [U-Boot] [PATCH] fw_env: add NAND support In-Reply-To: References: <20080902203222.0673624346@gemini.denx.de> Message-ID: <20080903132331.1958D248A0@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 Guennadi, In message you wrote: > > > would become: > > > > if (crc0_ok && !crc1_ok) { > > dev_current = 0; > > } else if (!crc0_ok && crc1_ok) { > > dev_current = 1; > > > > If "0" is OK, then use "0"; if "1" is ok then use "1". > > > > Your version: if "1" is OK then use "0", if "2" is OK then use "1" > > is more difficult to read. > > > > [Or stick with the old identifiers, i. e. use 1 and 2 consistently, > > but don't mix 0/1 here and 1/2 there.] > > Sorry, don't understand. This is the original code: > > if (crc1_ok && !crc2_ok) { > environment.data = addr1; > environment.flags = flag1; > environment.crc = crc1; > curdev = 0; > free (addr2); > > Which looks to me like "if (crc1_ok...) {... curdev = 0;...}", which I > tried to preserve. So, you would prefer me to _change_ it? ...except that that nor "curdev =0" is present anywhere, but instead the index "1" is used consistently: crc1_ok, addr1, flag1, crc1. > As far as I understand, with rc == 3 there is no DEVESIZE in the line, > which doesn't look like a valid configuration line to me. The orginal code > however accepted such lines and only dropped lines with rc < 3. I do not > understand how the original code managed to work with rc == 3. As I > thought this was a bug, I changed the test to "rc < 4", i.e., now I Did you verify that is was a bug? 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@denx.de Ever try. Ever fail. No matter. Try again. Fail again. Fail better. -- S. Beckett