mtd: unify initialization of erase_info->fail_addr

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Mar 26 20:59:20 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=3b27dac03972c10980ec5480ad8425fc95aae9ad
Commit:     3b27dac03972c10980ec5480ad8425fc95aae9ad
Parent:     637957551c0ac80de8dfc7650d320c5a98c2c0c0
Author:     Shmulik Ladkani <shmulik.ladkani at gmail.com>
AuthorDate: Thu Feb 9 15:36:29 2012 +0200
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Tue Mar 27 01:02:24 2012 +0100

    mtd: unify initialization of erase_info->fail_addr
    
    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 <shmulik.ladkani at gmail.com>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/mtdconcat.c            |    2 --
 drivers/mtd/mtdcore.c              |    1 +
 drivers/mtd/nand/nand_base.c       |    2 --
 drivers/mtd/onenand/onenand_base.c |    2 --
 fs/jffs2/erase.c                   |    1 -
 5 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index f7a31cc..b900056 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -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);
 
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index b274fdf..c837507 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -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);
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 0bcc715..47b19c0 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -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);
 
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 3d781b8..b3ce12e 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -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);
 
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index e7594c6..4a6cf28 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -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;



More information about the linux-mtd-cvs mailing list