[PATCH 2/2] mtd: Remove the no longer need functions, check_free_sectors and memcmpb

Nicholas Krause xerofoify at gmail.com
Fri Jan 16 10:05:45 PST 2015


The functions,check_free_sectors and memcmpb are no longer needed due to
removing the only caller for both functions in check_free_sectors for
memcmpb and in INFTL_formatblock for check_free_sectors respectfully.

Signed-off-by: Nicholas Krause <xerofoify at gmail.com>
---
 drivers/mtd/inftlmount.c | 40 ----------------------------------------
 1 file changed, 40 deletions(-)

diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c
index f5808ad..d0a7b7c 100644
--- a/drivers/mtd/inftlmount.c
+++ b/drivers/mtd/inftlmount.c
@@ -319,46 +319,6 @@ static int find_boot_record(struct INFTLrecord *inftl)
 	return -1;
 }
 
-static int memcmpb(void *a, int c, int n)
-{
-	int i;
-	for (i = 0; i < n; i++) {
-		if (c != ((unsigned char *)a)[i])
-			return 1;
-	}
-	return 0;
-}
-
-/*
- * check_free_sector: check if a free sector is actually FREE,
- *	i.e. All 0xff in data and oob area.
- */
-static int check_free_sectors(struct INFTLrecord *inftl, unsigned int address,
-	int len, int check_oob)
-{
-	u8 buf[SECTORSIZE + inftl->mbd.mtd->oobsize];
-	struct mtd_info *mtd = inftl->mbd.mtd;
-	size_t retlen;
-	int i;
-
-	for (i = 0; i < len; i += SECTORSIZE) {
-		if (mtd_read(mtd, address, SECTORSIZE, &retlen, buf))
-			return -1;
-		if (memcmpb(buf, 0xff, SECTORSIZE) != 0)
-			return -1;
-
-		if (check_oob) {
-			if(inftl_read_oob(mtd, address, mtd->oobsize,
-					  &retlen, &buf[SECTORSIZE]) < 0)
-				return -1;
-			if (memcmpb(buf + SECTORSIZE, 0xff, mtd->oobsize) != 0)
-				return -1;
-		}
-		address += SECTORSIZE;
-	}
-
-	return 0;
-}
 
 /*
  * INFTL_format: format a Erase Unit by erasing ALL Erase Zones in the Erase
-- 
2.1.0




More information about the linux-mtd mailing list