diff options
author | Andy Shevchenko <andy.shevchenko@gmail.com> | 2015-01-07 15:37:20 -0500 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2015-01-09 18:26:29 -0500 |
commit | 768c57c8d7df479aa27330d629b4e41f9c19b22c (patch) | |
tree | 183fa4d0d6a0b3f9e0bfc87861a5138979a77e46 /drivers/mtd | |
parent | 57f5ef14a5ffbf4bad7d761e844efede21a1c975 (diff) |
mtd: nftl: 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.
Reported-by: Andrey Karpov <karpov@viva64.com>
Cc: Giel van Schijndel <me@mortis.eu>
Cc: Dimitri Gorokhovik <dimitri.gorokhovik@free.fr>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nftlmount.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/mtd/nftlmount.c b/drivers/mtd/nftlmount.c index 51b9d6af307f..a5dfbfbebfca 100644 --- a/drivers/mtd/nftlmount.c +++ b/drivers/mtd/nftlmount.c | |||
@@ -89,9 +89,10 @@ static int find_boot_record(struct NFTLrecord *nftl) | |||
89 | } | 89 | } |
90 | 90 | ||
91 | /* To be safer with BIOS, also use erase mark as discriminant */ | 91 | /* To be safer with BIOS, also use erase mark as discriminant */ |
92 | if ((ret = nftl_read_oob(mtd, block * nftl->EraseSize + | 92 | ret = nftl_read_oob(mtd, block * nftl->EraseSize + |
93 | SECTORSIZE + 8, 8, &retlen, | 93 | SECTORSIZE + 8, 8, &retlen, |
94 | (char *)&h1) < 0)) { | 94 | (char *)&h1); |
95 | if (ret < 0) { | ||
95 | printk(KERN_WARNING "ANAND header found at 0x%x in mtd%d, but OOB data read failed (err %d)\n", | 96 | printk(KERN_WARNING "ANAND header found at 0x%x in mtd%d, but OOB data read failed (err %d)\n", |
96 | block * nftl->EraseSize, nftl->mbd.mtd->index, ret); | 97 | block * nftl->EraseSize, nftl->mbd.mtd->index, ret); |
97 | continue; | 98 | continue; |
@@ -109,8 +110,9 @@ static int find_boot_record(struct NFTLrecord *nftl) | |||
109 | } | 110 | } |
110 | 111 | ||
111 | /* Finally reread to check ECC */ | 112 | /* Finally reread to check ECC */ |
112 | if ((ret = mtd->read(mtd, block * nftl->EraseSize, SECTORSIZE, | 113 | ret = mtd->read(mtd, block * nftl->EraseSize, SECTORSIZE, |
113 | &retlen, buf) < 0)) { | 114 | &retlen, buf); |
115 | if (ret < 0) { | ||
114 | printk(KERN_NOTICE "ANAND header found at 0x%x in mtd%d, but ECC read failed (err %d)\n", | 116 | printk(KERN_NOTICE "ANAND header found at 0x%x in mtd%d, but ECC read failed (err %d)\n", |
115 | block * nftl->EraseSize, nftl->mbd.mtd->index, ret); | 117 | block * nftl->EraseSize, nftl->mbd.mtd->index, ret); |
116 | continue; | 118 | continue; |
@@ -228,9 +230,11 @@ device is already correct. | |||
228 | The new DiskOnChip driver already scanned the bad block table. Just query it. | 230 | The new DiskOnChip driver already scanned the bad block table. Just query it. |
229 | if ((i & (SECTORSIZE - 1)) == 0) { | 231 | if ((i & (SECTORSIZE - 1)) == 0) { |
230 | /* read one sector for every SECTORSIZE of blocks */ | 232 | /* read one sector for every SECTORSIZE of blocks */ |
231 | if ((ret = mtd->read(nftl->mbd.mtd, block * nftl->EraseSize + | 233 | ret = mtd->read(nftl->mbd.mtd, |
232 | i + SECTORSIZE, SECTORSIZE, &retlen, | 234 | block * nftl->EraseSize + i + |
233 | buf)) < 0) { | 235 | SECTORSIZE, SECTORSIZE, |
236 | &retlen, buf); | ||
237 | if (ret < 0) { | ||
234 | printk(KERN_NOTICE "Read of bad sector table failed (err %d)\n", | 238 | printk(KERN_NOTICE "Read of bad sector table failed (err %d)\n", |
235 | ret); | 239 | ret); |
236 | kfree(nftl->ReplUnitTable); | 240 | kfree(nftl->ReplUnitTable); |