Skip to content

Commit

Permalink
mtd: unify initialization of erase_info->fail_addr
Browse files Browse the repository at this point in the history
Initialization of 'erase_info->fail_addr' to MTD_FAIL_ADDR_UNKNOWN prior
erase operation is duplicated accross several MTD drivers, and also taken
care of by some MTD users as well.

Harmonize it: initialize 'fail_addr' within 'mtd_erase()' interface.

Signed-off-by: Shmulik Ladkani <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
  • Loading branch information
sladkani authored and David Woodhouse committed Mar 27, 2012
1 parent 6379575 commit 3b27dac
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 7 deletions.
2 changes: 0 additions & 2 deletions drivers/mtd/mtdconcat.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,6 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
return -EINVAL;
}

instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;

/* make a local copy of instr to avoid modifying the caller's struct */
erase = kmalloc(sizeof (struct erase_info), GFP_KERNEL);

Expand Down
1 change: 1 addition & 0 deletions drivers/mtd/mtdcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ int mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
return -EINVAL;
if (!(mtd->flags & MTD_WRITEABLE))
return -EROFS;
instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
if (!instr->len) {
instr->state = MTD_ERASE_DONE;
mtd_erase_callback(instr);
Expand Down
2 changes: 0 additions & 2 deletions drivers/mtd/nand/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2550,8 +2550,6 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
if (check_offs_len(mtd, instr->addr, instr->len))
return -EINVAL;

instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;

/* Grab the lock and see if the device is available */
nand_get_device(chip, mtd, FL_ERASING);

Expand Down
2 changes: 0 additions & 2 deletions drivers/mtd/onenand/onenand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2502,8 +2502,6 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr)
return -EINVAL;
}

instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;

/* Grab the lock and see if the device is available */
onenand_get_device(mtd, FL_ERASING);

Expand Down
1 change: 0 additions & 1 deletion fs/jffs2/erase.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
instr->len = c->sector_size;
instr->callback = jffs2_erase_callback;
instr->priv = (unsigned long)(&instr[1]);
instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;

((struct erase_priv_struct *)instr->priv)->jeb = jeb;
((struct erase_priv_struct *)instr->priv)->c = c;
Expand Down

0 comments on commit 3b27dac

Please sign in to comment.