mtd/drivers/mtd/nand diskonchip.c,1.38,1.39

gleixner at infradead.org gleixner at infradead.org
Wed Nov 3 15:07:17 EST 2004


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

Modified Files:
	diskonchip.c 
Log Message:
move rs_decoder init ahead of scan, as it must be initialized in case a DoC is detected. Pointed out by Ed Berube <eberube at gmail.com>

Index: diskonchip.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/diskonchip.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- diskonchip.c	5 Oct 2004 22:11:46 -0000	1.38
+++ diskonchip.c	3 Nov 2004 20:07:15 -0000	1.39
@@ -1722,22 +1722,7 @@
 
 int __init init_nanddoc(void)
 {
-	int i;
-
-	if (doc_config_location) {
-		printk(KERN_INFO "Using configured DiskOnChip probe address 0x%lx\n", doc_config_location);
-		return doc_probe(doc_config_location);
-	} else {
-		for (i=0; (doc_locations[i] != 0xffffffff); i++) {
-			doc_probe(doc_locations[i]);
-		}
-	}
-	/* No banner message any more. Print a message if no DiskOnChip
-	   found, so the user knows we at least tried. */
-	if (!doclist) {
-		printk(KERN_INFO "No valid DiskOnChip devices found\n");
-		return -ENODEV;
-	}
+	int i, ret = 0;
 
 	/* We could create the decoder on demand, if memory is a concern.
 	 * This way we have it handy, if an error happens 
@@ -1751,11 +1736,30 @@
 	rs_decoder = init_rs(10, 0x409, FCR, 1, NROOTS);
  	if (!rs_decoder) {
 		printk (KERN_ERR "DiskOnChip: Could not create a RS decoder\n");
-		release_nanddoc();
 		return -ENOMEM;
 	}
 
+	if (doc_config_location) {
+		printk(KERN_INFO "Using configured DiskOnChip probe address 0x%lx\n", doc_config_location);
+		ret = doc_probe(doc_config_location);
+		if (ret < 0)
+			goto outerr;
+	} else {
+		for (i=0; (doc_locations[i] != 0xffffffff); i++) {
+			doc_probe(doc_locations[i]);
+		}
+	}
+	/* No banner message any more. Print a message if no DiskOnChip
+	   found, so the user knows we at least tried. */
+	if (!doclist) {
+		printk(KERN_INFO "No valid DiskOnChip devices found\n");
+		ret = -ENODEV;
+		goto outerr;
+	}
 	return 0;
+outerr:
+	free_rs(rs_decoder);
+	return ret;
 }
 
 void __exit cleanup_nanddoc(void)





More information about the linux-mtd-cvs mailing list