diff options
-rw-r--r-- | drivers/mtd/onenand/onenand_base.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 38e6d76bcc0e..4205b9423b89 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/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, | |||
1648 | int ret = 0; | 1648 | int ret = 0; |
1649 | int thislen, column; | 1649 | int thislen, column; |
1650 | 1650 | ||
1651 | column = addr & (this->writesize - 1); | ||
1652 | |||
1651 | while (len != 0) { | 1653 | while (len != 0) { |
1652 | thislen = min_t(int, this->writesize, len); | 1654 | thislen = min_t(int, this->writesize - column, len); |
1653 | column = addr & (this->writesize - 1); | ||
1654 | if (column + thislen > this->writesize) | ||
1655 | thislen = this->writesize - column; | ||
1656 | 1655 | ||
1657 | this->command(mtd, ONENAND_CMD_READ, addr, this->writesize); | 1656 | this->command(mtd, ONENAND_CMD_READ, addr, this->writesize); |
1658 | 1657 | ||
@@ -1666,12 +1665,13 @@ static int onenand_verify(struct mtd_info *mtd, const u_char *buf, loff_t addr, | |||
1666 | 1665 | ||
1667 | this->read_bufferram(mtd, ONENAND_DATARAM, this->verify_buf, 0, mtd->writesize); | 1666 | this->read_bufferram(mtd, ONENAND_DATARAM, this->verify_buf, 0, mtd->writesize); |
1668 | 1667 | ||
1669 | if (memcmp(buf, this->verify_buf, thislen)) | 1668 | if (memcmp(buf, this->verify_buf + column, thislen)) |
1670 | return -EBADMSG; | 1669 | return -EBADMSG; |
1671 | 1670 | ||
1672 | len -= thislen; | 1671 | len -= thislen; |
1673 | buf += thislen; | 1672 | buf += thislen; |
1674 | addr += thislen; | 1673 | addr += thislen; |
1674 | column = 0; | ||
1675 | } | 1675 | } |
1676 | 1676 | ||
1677 | return 0; | 1677 | return 0; |