mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 16:20:55 +07:00
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>
This commit is contained in:
parent
57f5ef14a5
commit
768c57c8d7
@ -89,9 +89,10 @@ static int find_boot_record(struct NFTLrecord *nftl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* To be safer with BIOS, also use erase mark as discriminant */
|
/* 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,
|
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",
|
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);
|
block * nftl->EraseSize, nftl->mbd.mtd->index, ret);
|
||||||
continue;
|
continue;
|
||||||
@ -109,8 +110,9 @@ static int find_boot_record(struct NFTLrecord *nftl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Finally reread to check ECC */
|
/* Finally reread to check ECC */
|
||||||
if ((ret = mtd->read(mtd, block * nftl->EraseSize, SECTORSIZE,
|
ret = mtd->read(mtd, block * nftl->EraseSize, SECTORSIZE,
|
||||||
&retlen, buf) < 0)) {
|
&retlen, buf);
|
||||||
|
if (ret < 0) {
|
||||||
printk(KERN_NOTICE "ANAND header found at 0x%x in mtd%d, but ECC read failed (err %d)\n",
|
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);
|
block * nftl->EraseSize, nftl->mbd.mtd->index, ret);
|
||||||
continue;
|
continue;
|
||||||
@ -228,9 +230,11 @@ device is already correct.
|
|||||||
The new DiskOnChip driver already scanned the bad block table. Just query it.
|
The new DiskOnChip driver already scanned the bad block table. Just query it.
|
||||||
if ((i & (SECTORSIZE - 1)) == 0) {
|
if ((i & (SECTORSIZE - 1)) == 0) {
|
||||||
/* read one sector for every SECTORSIZE of blocks */
|
/* read one sector for every SECTORSIZE of blocks */
|
||||||
if ((ret = mtd->read(nftl->mbd.mtd, block * nftl->EraseSize +
|
ret = mtd->read(nftl->mbd.mtd,
|
||||||
i + SECTORSIZE, SECTORSIZE, &retlen,
|
block * nftl->EraseSize + i +
|
||||||
buf)) < 0) {
|
SECTORSIZE, SECTORSIZE,
|
||||||
|
&retlen, buf);
|
||||||
|
if (ret < 0) {
|
||||||
printk(KERN_NOTICE "Read of bad sector table failed (err %d)\n",
|
printk(KERN_NOTICE "Read of bad sector table failed (err %d)\n",
|
||||||
ret);
|
ret);
|
||||||
kfree(nftl->ReplUnitTable);
|
kfree(nftl->ReplUnitTable);
|
||||||
|
Loading…
Reference in New Issue
Block a user