mtd: nftl: reorganize operations in condition check
PATCH v2 1/1 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.
--- drivers/mtd/nftlmount.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/mtd/nftlmount.c +11 -7
@@ -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 ;
@@ -109,8 +110,9 @@ 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 )) { + ret = mtd->read (mtd, block * nftl->EraseSize,SECTORSIZE , + &retlen, buf); +if (ret <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 ;
@@ -228,9 +230,11 @@ device is already correct. The new DiskOnChip driver already scanned the bad block table. Just query it.if ((i & (SECTORSIZE -1 )) ==0 ) {/* read one sector for every SECTORSIZE of blocks */ -if ((ret = mtd->read (nftl->mbd.mtd, block * nftl->EraseSize + - i +SECTORSIZE ,SECTORSIZE , &retlen, - buf)) <0 ) { + ret = mtd->read (nftl->mbd.mtd, + block * nftl->EraseSize + i + +SECTORSIZE ,SECTORSIZE , + &retlen, buf); +if (ret <0 ) {printk (KERN_NOTICE "Read of bad sector table failed (err %d)\n" , ret);kfree (nftl->ReplUnitTable);
Signature · 1 line
1.8.3.101.g727a46b
Quoted 8 lines · Andy Shevchenko
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 <[email protected]>Cc Giel van Schijndel <[email protected]>Cc Dimitri Gorokhovik <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
To be clear, this touches some commented out code (yuck). I think you noted this previously.
For my reference, are you actually testing this driver?
Anyway, pushed to l2-mtd.git. Thanks.
Brian
Quoted 5 lines · Brian Norris
Quoted 4 lines · Andy Shevchenko
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.
Quoted 7 lines
Quoted 4 lines
Reported-by Andrey Karpov <[email protected]>Cc Giel van Schijndel <[email protected]>Cc Dimitri Gorokhovik <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>To be clear, this touches some commented out code (yuck). I think you noted this previously.
It had been proposed by Giel.
Quoted 3 lines
For my reference, are you actually testing this driver?
Not a real testing. Only compilation on x86_32.
Quoted 1 line
Anyway, pushed to l2-mtd.git. Thanks.
Thanks!
Quoted 2 lines
Brian
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 11 lines · Andy Shevchenko
Quoted 10 lines · Brian Norris
Quoted 8 lines · Andy Shevchenko
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 <[email protected]>Cc Giel van Schijndel <[email protected]>Cc Dimitri Gorokhovik <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
Quoted 4 lines
Quoted 2 lines
To be clear, this touches some commented out code (yuck). I think you noted this previously.
It had been proposed by Giel.
Yes, and I suspect (and hope) Brian's referring to the existence of commented-out code as "yuck", not the removal of bugs from it.
Quoted 3 lines
Quoted 1 line
For my reference, are you actually testing this driver?
Not a real testing. Only compilation on
x86_32.
Combined with review I think that's enough given the nature of this change.
Signature · 3 lines
Met vriendelijke groet, With kind regards, Giel van Schijndel
Quoted 12 lines · Giel van Schijndel
Quoted 11 lines · Andy Shevchenko
Quoted 10 lines · Brian Norris
Quoted 8 lines · Andy Shevchenko
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 <[email protected]>Cc Giel van Schijndel <[email protected]>Cc Dimitri Gorokhovik <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
To be clear, this touches some commented out code (yuck). I think you noted this previously.
It had been proposed by Giel.
Yes, and I suspect (and hope) Brian's referring to the existence of commented-out code as "yuck", not the removal of bugs from it.
Yes, I was just commenting about the existence of all that dead code. The code won't even compile now, as it's using some old interfaces.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
For my reference, are you actually testing this driver?
Not a real testing. Only compilation on
x86_32.Combined with review I think that's enough given the nature of this change.
Yeah, I wasn't objecting to fixing this trivial stuff. I just don't know who uses some of the aging drivers we have in MTD.
Brian