mtd/drivers/mtd/chips cfi_cmdset_0001.c,1.157,1.158

Nicolas Pitre nico at infradead.org
Fri Oct 22 14:42:17 EDT 2004


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

Modified Files:
	cfi_cmdset_0001.c 
Log Message:
fix unbalanced get_chip() and put_chip() in do_erase_oneblock()


Index: cfi_cmdset_0001.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0001.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -r1.157 -r1.158
--- cfi_cmdset_0001.c	15 Oct 2004 20:00:26 -0000	1.157
+++ cfi_cmdset_0001.c	22 Oct 2004 18:42:13 -0000	1.158
@@ -1420,9 +1420,8 @@
 			/* Clear status bits */
 			map_write(map, CMD(0x50), adr);
 			map_write(map, CMD(0x70), adr);
-			DISABLE_VPP(map);
-			spin_unlock(chip->mutex);
-			return -EIO;
+			ret = -EIO;
+			goto out;
 		}
 		
 		/* Latency issues. Drop the lock, wait a while and retry */
@@ -1432,9 +1431,6 @@
 		spin_lock(chip->mutex);
 	}
 	
-	DISABLE_VPP(map);
-	ret = 0;
-
 	/* We've broken this before. It doesn't hurt to be safe */
 	map_write(map, CMD(0x70), adr);
 	chip->state = FL_STATUS;
@@ -1472,15 +1468,18 @@
 				printk(KERN_DEBUG "Chip erase failed at 0x%08lx: status 0x%x. Retrying...\n", adr, chipstatus);
 				timeo = jiffies + HZ;
 				chip->state = FL_STATUS;
+				put_chip(map, chip, adr);
 				spin_unlock(chip->mutex);
 				goto retry;
 			}
 			printk(KERN_DEBUG "Chip erase failed at 0x%08lx: status 0x%x\n", adr, chipstatus);
 			ret = -EIO;
 		}
+	} else {
+		ret = 0;
 	}
 
-	wake_up(&chip->wq);
+out:	put_chip(map, chip, adr);
 	spin_unlock(chip->mutex);
 	return ret;
 }





More information about the linux-mtd-cvs mailing list