Skip to contentSkip to conversation

mtd: misplaced parenthesis in find_boot_record()

PATCH In review Roel Kluin 3 participants 4 messages Feb 15, 2010 – Feb 26, 2010 Memory technology devices (MTD)

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 mtd: misplaced parenthesis in find_boot_record()

The parenthesis was misplaced, upon error a one was shown.

---

drivers/mtd/inftlmount.c +1 -1
index 32e82ae..a269c62 100644
@@ -102,7 +102,7 @@ static int find_boot_record(struct INFTLrecord *inftl)
 		/* To be safer with BIOS, also use erase mark as discriminant */
 		if ((ret = inftl_read_oob(mtd, block * inftl->EraseSize +
 					  SECTORSIZE + 8, 8, &retlen,
-					  (char *)&h1) < 0)) {
+					  (char *)&h1)) < 0) {
 			printk(KERN_WARNING "INFTL: ANAND header found at "
 				"0x%x in mtd%d, but OOB data read failed "
 				"(err %d)\n", block * inftl->EraseSize,
author
#1 lore raw

The parenthesis was misplaced

---
Not sure if you care about this one, it is between #if 0 ... #endif

drivers/mtd/nftlmount.c +1 -1
index 8b22b18..1ae6a02 100644
@@ -109,7 +109,7 @@ static int find_boot_record(struct NFTLrecord *nftl)
 
 		/* Finally reread to check ECC */
 		if ((ret = mtd->read(mtd, block * nftl->EraseSize, SECTORSIZE,
-				     &retlen, buf) < 0)) {
+				     &retlen, buf)) < 0) {
 			printk(KERN_NOTICE "ANAND header found at 0x%x in mtd%d, but ECC read failed (err %d)\n",
 			       block * nftl->EraseSize, nftl->mbd.mtd->index, ret);
 			continue;
#2 lore raw
Quoted 11 lines · Roel Kluin

The parenthesis was misplaced

---
Not sure if you care about this one, it is between #if 0 ... #endif

drivers/mtd/nftlmount.c +0 -0
index 8b22b18..1ae6a02 100644

drivers/mtd/nftlmount.c static int find_boot_record(struct NFTLrecord *nftl) · line 115

Quoted 8 lines
drivers/mtd/nftlmount.c +1 -1
@@ -109,7 +109,7 @@ static int find_boot_record(struct NFTLrecord *nftl)
 
 		/* Finally reread to check ECC */
 		if ((ret = mtd->read(mtd, block * nftl->EraseSize, SECTORSIZE,
-				     &retlen, buf) < 0)) {
+				     &retlen, buf)) < 0) {
 			printk(KERN_NOTICE "ANAND header found at 0x%x in mtd%d, but ECC read failed (err %d)\n",
 			       block * nftl->EraseSize, nftl->mbd.mtd->index, ret);
 			continue;

Pushed both patches to my l2-mtd-2.6.git / master.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
#3 lore raw
In reply to Roel Kluin
Quoted 10 lines · Roel Kluin

The parenthesis was misplaced, upon error a one was shown.

---

drivers/mtd/inftlmount.c +0 -0
index 32e82ae..a269c62 100644

drivers/mtd/inftlmount.c static int find_boot_record(struct INFTLrecord *inftl) · line 105

Quoted 5 lines
drivers/mtd/inftlmount.c +1 -1
@@ -102,7 +102,7 @@ static int find_boot_record(struct INFTLrecord *inftl)
 		/* To be safer with BIOS, also use erase mark as discriminant */
 		if ((ret = inftl_read_oob(mtd, block * inftl->EraseSize +
 					  SECTORSIZE + 8, 8, &retlen,
-					  (char *)&h1) < 0)) {
+					  (char *)&h1)) < 0) {

Ick.

This code is broken because it's fugly. You can see the causality just by looking at it.

Why on earth would you fix the bug but not fix the fugliness which caused it?

   ret = inftl_read_oob(...);
   if (ret < 0) {
Signature · 2 lines
David Woodhouse                            Open Source Technology Centre
[email protected]                              Intel Corporation