mtd/drivers/mtd/nand diskonchip.c,1.32,1.33

David Woodhouse dwmw2 at infradead.org
Mon Aug 9 10:16:43 EDT 2004


Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv6230/nand

Modified Files:
	diskonchip.c 
Log Message:
size_t and min/max fixes from Al

Index: diskonchip.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/diskonchip.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- diskonchip.c	9 Aug 2004 13:19:45 -0000	1.32
+++ diskonchip.c	9 Aug 2004 14:16:40 -0000	1.33
@@ -949,10 +949,11 @@
 {
 	struct nand_chip *this = mtd->priv;
 	struct doc_priv *doc = (void *)this->priv;
-	int offs, end = (MAX_MEDIAHEADER_SCAN << this->phys_erase_shift);
-	int ret, retlen;
+	unsigned offs, end = (MAX_MEDIAHEADER_SCAN << this->phys_erase_shift);
+	int ret;
+	size_t retlen;
 
-	end = min(end, (int)mtd->size); // paranoia
+	end = min(end, mtd->size); // paranoia
 	for (offs = 0; offs < end; offs += mtd->erasesize) {
 		ret = mtd->read(mtd, offs, mtd->oobblock, &retlen, buf);
 		if (retlen != mtd->oobblock) continue;
@@ -994,8 +995,8 @@
 	int ret = 0;
 	u_char *buf;
 	struct NFTLMediaHeader *mh;
-	const int psize = 1 << this->page_shift;
-	int blocks, maxblocks;
+	const unsigned psize = 1 << this->page_shift;
+	unsigned blocks, maxblocks;
 	int offs, numheaders;
 
 	buf = kmalloc(mtd->oobblock, GFP_KERNEL);
@@ -1019,7 +1020,7 @@
 //#endif
 
 	blocks = mtd->size >> this->phys_erase_shift;
-	maxblocks = min(32768, (int)mtd->erasesize - psize);
+	maxblocks = min(32768U, mtd->erasesize - psize);
 
 	if (mh->UnitSizeFactor == 0x00) {
 		/* Auto-determine UnitSizeFactor.  The constraints are:
@@ -1030,7 +1031,7 @@
 		mh->UnitSizeFactor = 0xff;
 		while (blocks > maxblocks) {
 			blocks >>= 1;
-			maxblocks = min(32768, (maxblocks << 1) + psize);
+			maxblocks = min(32768U, (maxblocks << 1) + psize);
 			mh->UnitSizeFactor--;
 		}
 		printk(KERN_WARNING "UnitSizeFactor=0x00 detected.  Correct value is assumed to be 0x%02x.\n", mh->UnitSizeFactor);
@@ -1046,7 +1047,7 @@
 		mtd->erasesize <<= (0xff - mh->UnitSizeFactor);
 		printk(KERN_INFO "Setting virtual erase size to %d\n", mtd->erasesize);
 		blocks = mtd->size >> this->bbt_erase_shift;
-		maxblocks = min(32768, (int)mtd->erasesize - psize);
+		maxblocks = min(32768U, mtd->erasesize - psize);
 	}
 
 	if (blocks > maxblocks) {





More information about the linux-mtd-cvs mailing list