mtd: unify initialization of erase_info->fail_addr
authorShmulik Ladkani <shmulik.ladkani@gmail.com>
Thu, 9 Feb 2012 13:36:29 +0000 (15:36 +0200)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Tue, 27 Mar 2012 00:02:24 +0000 (01:02 +0100)
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@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/mtdconcat.c
drivers/mtd/mtdcore.c
drivers/mtd/nand/nand_base.c
drivers/mtd/onenand/onenand_base.c
fs/jffs2/erase.c

index f7a31cc44480c1882c0050961a3dacb721314300..b9000563b9f4311d63ffdfe66ba5166eb158b482 100644 (file)
@@ -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);
 
index b274fdf5f358c2d5c01d9a215db799da2a4decd5..c837507dfb1c73021da2a47eebd975bd40573ef9 100644 (file)
@@ -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);
index 0bcc71539b160293cfc6dd866821df3dc4292f96..47b19c0bb070e3da612b031848496f7551c2589f 100644 (file)
@@ -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);
 
index 3d781b87b35869c95c5f8d7af41140eae14d5547..b3ce12ef359e83777280aff2b6f9fa9d58cc4dc9 100644 (file)
@@ -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);
 
index e7594c604d2885d5cc50c14f108c9874e6974101..4a6cf289be248cbfaedc60dea23afc84fcbbbf44 100644 (file)
@@ -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;