X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=drivers%2Fmtd%2Finftlcore.c;h=50ce13887f63b6b81d2525a5070fbfc511643b1c;hb=d9a682a592ff5905d328c648fd30ee7fa12ce8ab;hp=c4f9d3378b24c658f246d8777d47735050cfdffe;hpb=31677619650cac2bcc9f50920824323b005e3d8a;p=karo-tx-linux.git diff --git a/drivers/mtd/inftlcore.c b/drivers/mtd/inftlcore.c index c4f9d3378b24..50ce13887f63 100644 --- a/drivers/mtd/inftlcore.c +++ b/drivers/mtd/inftlcore.c @@ -388,6 +388,10 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned if (thisEUN == targetEUN) break; + /* Unlink the last block from the chain. */ + inftl->PUtable[prevEUN] = BLOCK_NIL; + + /* Now try to erase it. */ if (INFTL_formatblock(inftl, thisEUN) < 0) { /* * Could not erase : mark block as reserved. @@ -396,7 +400,6 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned } else { /* Correctly erased : mark it as free */ inftl->PUtable[thisEUN] = BLOCK_FREE; - inftl->PUtable[prevEUN] = BLOCK_NIL; inftl->numfreeEUNs++; } }