diff options
Diffstat (limited to 'drivers/mtd/nftlmount.c')
-rw-r--r-- | drivers/mtd/nftlmount.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/mtd/nftlmount.c b/drivers/mtd/nftlmount.c index 3b104ebb219a..90e5e7e97fdc 100644 --- a/drivers/mtd/nftlmount.c +++ b/drivers/mtd/nftlmount.c | |||
@@ -268,18 +268,22 @@ static int memcmpb(void *a, int c, int n) | |||
268 | static int check_free_sectors(struct NFTLrecord *nftl, unsigned int address, int len, | 268 | static int check_free_sectors(struct NFTLrecord *nftl, unsigned int address, int len, |
269 | int check_oob) | 269 | int check_oob) |
270 | { | 270 | { |
271 | int i; | ||
272 | size_t retlen; | ||
273 | u8 buf[SECTORSIZE + nftl->mbd.mtd->oobsize]; | 271 | u8 buf[SECTORSIZE + nftl->mbd.mtd->oobsize]; |
272 | struct mtd_info *mtd = nftl->mbd.mtd; | ||
273 | size_t retlen; | ||
274 | int i; | ||
274 | 275 | ||
275 | for (i = 0; i < len; i += SECTORSIZE) { | 276 | for (i = 0; i < len; i += SECTORSIZE) { |
276 | if (MTD_READECC(nftl->mbd.mtd, address, SECTORSIZE, &retlen, buf, &buf[SECTORSIZE], &nftl->oobinfo) < 0) | 277 | if (mtd->read(mtd, address, SECTORSIZE, &retlen, buf)) |
277 | return -1; | 278 | return -1; |
278 | if (memcmpb(buf, 0xff, SECTORSIZE) != 0) | 279 | if (memcmpb(buf, 0xff, SECTORSIZE) != 0) |
279 | return -1; | 280 | return -1; |
280 | 281 | ||
281 | if (check_oob) { | 282 | if (check_oob) { |
282 | if (memcmpb(buf + SECTORSIZE, 0xff, nftl->mbd.mtd->oobsize) != 0) | 283 | if(mtd->read_oob(mtd, address, mtd->oobsize, |
284 | &retlen, &buf[SECTORSIZE]) < 0) | ||
285 | return -1; | ||
286 | if (memcmpb(buf + SECTORSIZE, 0xff, mtd->oobsize) != 0) | ||
283 | return -1; | 287 | return -1; |
284 | } | 288 | } |
285 | address += SECTORSIZE; | 289 | address += SECTORSIZE; |