From 4b2fdc5e750a2c6ce17ac3d3a101556f2e0f63ac Mon Sep 17 00:00:00 2001 From: Roman Tereshonkov Date: Tue, 8 Feb 2011 12:02:42 +0200 Subject: [PATCH] --- yaml --- r: 242761 b: refs/heads/master c: e6da85685b2dec1e69e58366c22d1f883d6da575 h: refs/heads/master i: 242759: 53fec9aefed109f9e7d43501d3ec51e9e60a0d1b v: v3 --- [refs] | 2 +- trunk/drivers/mtd/onenand/onenand_base.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index a7bde640e29b..81f4d08efab3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b085058fe556328443f982d892c9657b3aff9d4a +refs/heads/master: e6da85685b2dec1e69e58366c22d1f883d6da575 diff --git a/trunk/drivers/mtd/onenand/onenand_base.c b/trunk/drivers/mtd/onenand/onenand_base.c index 38e6d76bcc0e..4205b9423b89 100644 --- a/trunk/drivers/mtd/onenand/onenand_base.c +++ b/trunk/drivers/mtd/onenand/onenand_base.c @@ -1648,11 +1648,10 @@ static int onenand_verify(struct mtd_info *mtd, const u_char *buf, loff_t addr, int ret = 0; int thislen, column; + column = addr & (this->writesize - 1); + while (len != 0) { - thislen = min_t(int, this->writesize, len); - column = addr & (this->writesize - 1); - if (column + thislen > this->writesize) - thislen = this->writesize - column; + thislen = min_t(int, this->writesize - column, len); this->command(mtd, ONENAND_CMD_READ, addr, this->writesize); @@ -1666,12 +1665,13 @@ static int onenand_verify(struct mtd_info *mtd, const u_char *buf, loff_t addr, this->read_bufferram(mtd, ONENAND_DATARAM, this->verify_buf, 0, mtd->writesize); - if (memcmp(buf, this->verify_buf, thislen)) + if (memcmp(buf, this->verify_buf + column, thislen)) return -EBADMSG; len -= thislen; buf += thislen; addr += thislen; + column = 0; } return 0;