From: Valeriy Glushkov Date: Fri, 17 Jul 2009 11:11:53 +0300 Subject: [U-Boot] [PATCH] nand: fixed failed reads on corrected ECC errors in nand_util.c References: <124756867020-git-send-email-gvv@lstec.com> <20090716195035.GG32758@b07421-ec1.am.freescale.net> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Scott, >> if (len_incl_bad == *length) { >> rval = nand_read (nand, offset, length, buffer); >> - if (rval != 0) >> - printf ("NAND read from offset %llx failed %d\n", >> - offset, rval); >> - >> + if (!rval || rval == -EUCLEAN) >> + return 0; >> + printf ("NAND read from offset %llx failed %d\n", >> + offset, rval); > > Out of curiosity, why invert the logic from if (error) print; return to if > (!error) return; print; return? Because it looks a bit better for me than 2 other versions. And saves a line. :) ------- if (!rval || rval == -EUCLEAN) return 0; printf ("NAND read from offset %llx failed %d\n", offset, rval); return rval; -------- if (rval && rval != -EUCLEAN) { printf ("NAND read from offset %llx failed %d\n", offset, rval); return rval; } return 0; ------- if (rval && rval != -EUCLEAN) printf ("NAND read from offset %llx failed %d\n", offset, rval); else rval = 0; return rval; -------- Best regards, Valeriy Glushkov