Skip to contentSkip to conversation

mtd: ntfl: reorganize operations in condition check

PATCH Superseded Andy Shevchenko 1 participant 1 message Jan 6, 2015 Memory technology devices (MTD)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: ntfl: reorganize operations in condition check

We need to compare ret variable for negative value. The current code assigns the boolean to the ret and prints it wrongly in the warning message.

Cc Dimitri Gorokhovik <[email protected]>
---
 drivers/mtd/nftlmount.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mtd/nftlmount.c +3 -2
index 51b9d6a..557dfa2 100644
@@ -89,9 +89,10 @@ static int find_boot_record(struct NFTLrecord *nftl)
 		}
 
 		/* To be safer with BIOS, also use erase mark as discriminant */
-		if ((ret = nftl_read_oob(mtd, block * nftl->EraseSize +
+		ret = nftl_read_oob(mtd, block * nftl->EraseSize +
 					 SECTORSIZE + 8, 8, &retlen,
-					 (char *)&h1) < 0)) {
+					 (char *)&h1);
+		if (ret < 0) {
 			printk(KERN_WARNING "ANAND header found at 0x%x in mtd%d, but OOB data read failed (err %d)\n",
 			       block * nftl->EraseSize, nftl->mbd.mtd->index, ret);
 			continue;
Signature · 1 line
1.8.3.101.g727a46b