Skip to contentSkip to conversation

block2mtd: dubious assignment

PATCH In review Nicolas Kaiser 3 participants 3 messages Oct 22, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block2mtd: dubious assignment

When block2mtd_erase fails, a duplicated assignment instantly changes instr->state from MTD_ERASE_FAILED to MTD_ERASE_DONE.

It looks to me like this might not be intended, or is it?

---
 drivers/mtd/devices/block2mtd.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/mtd/devices/block2mtd.c +0 -1
index 9365186..2cf0cc6 100644
@@ -91,7 +91,6 @@ static int block2mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
 	} else
 		instr->state = MTD_ERASE_DONE;
 
-	instr->state = MTD_ERASE_DONE;
 	mtd_erase_callback(instr);
 	return err;
 }
Signature · 1 line
1.7.2.2
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Nicolas Kaiser

When block2mtd_erase fails, a duplicated assignment instantly changes instr->state from MTD_ERASE_FAILED to MTD_ERASE_DONE.

It looks to me like this might not be intended, or is it?

Definitely not. Just proves how well block device errors are tested.

Quoted 1 line

Artem, can I leave this patch to you as well?

Jörn

Signature · 2 lines
Eighty percent of success is showing up.
-- Woody Allen
#2 lore raw
Quoted 5 lines · Jörn Engel
Quoted 4 lines · Nicolas Kaiser

When block2mtd_erase fails, a duplicated assignment instantly changes instr->state from MTD_ERASE_FAILED to MTD_ERASE_DONE.

Quoted 8 lines
Quoted 1 line

It looks to me like this might not be intended, or is it?

Definitely not. Just proves how well block device errors are tested.

Quoted 1 line

Artem, can I leave this patch to you as well?

Yes, I'll put it to my l2 tree of course, thanks.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Битюцкий Артём)