From: Reitinger, Peter Date: Mon, 24 Jun 2019 13:43:54 +0000 Subject: [U-Boot] Bug in omap_gpmc.c:omap_nand_read_prefetch Message-ID: <1561383834822.17598@carl-valentin.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello, sorry I am completely new to these kind of mailing lists, and quite probably I violate most of the rules for using this mailing list, but I have a serious bug to report and actually no time at all... /u-boot_2019/drivers/mtd/nand/raw/omap_gpmc.c - function omap_nand_read_prefetch(): Whenever buf % 4 is neither 0 or 2 (i.e. 1 or 3), too few or too many bytes, respectively, are read before the calls to __read_prefetch_align. Suggested fix: original: /* * If the destination buffer is unaligned, start with reading * the overlap byte-wise. */ head = ((uint32_t) buf) % 4; if (head) { omap_nand_read(mtd, buf, head); buf += head; len -= head; } fixed: /* * If the destination buffer is unaligned, start with reading * the overlap byte-wise. */ head = ((uint32_t) buf) % 4; if (head) { head = 4 - head; // randomly equal to head if head == 2 ;-) omap_nand_read(mtd, buf, head); buf += head; len -= head; } Best regards Peter Reitinger