diff options
author | Shmulik Ladkani <shmulik.ladkani@gmail.com> | 2012-02-09 08:36:29 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-03-26 20:02:24 -0400 |
commit | 3b27dac03972c10980ec5480ad8425fc95aae9ad (patch) | |
tree | 62238107d409fd08ed06a0dc5e030d48aec320e4 /drivers/mtd | |
parent | 637957551c0ac80de8dfc7650d320c5a98c2c0c0 (diff) |
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@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/mtdconcat.c | 2 | ||||
-rw-r--r-- | drivers/mtd/mtdcore.c | 1 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 2 | ||||
-rw-r--r-- | drivers/mtd/onenand/onenand_base.c | 2 |
4 files changed, 1 insertions, 6 deletions
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index f7a31cc44480..b9000563b9f4 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) | |||
426 | return -EINVAL; | 426 | return -EINVAL; |
427 | } | 427 | } |
428 | 428 | ||
429 | instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN; | ||
430 | |||
431 | /* make a local copy of instr to avoid modifying the caller's struct */ | 429 | /* make a local copy of instr to avoid modifying the caller's struct */ |
432 | erase = kmalloc(sizeof (struct erase_info), GFP_KERNEL); | 430 | erase = kmalloc(sizeof (struct erase_info), GFP_KERNEL); |
433 | 431 | ||
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index b274fdf5f358..c837507dfb1c 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) | |||
695 | return -EINVAL; | 695 | return -EINVAL; |
696 | if (!(mtd->flags & MTD_WRITEABLE)) | 696 | if (!(mtd->flags & MTD_WRITEABLE)) |
697 | return -EROFS; | 697 | return -EROFS; |
698 | instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN; | ||
698 | if (!instr->len) { | 699 | if (!instr->len) { |
699 | instr->state = MTD_ERASE_DONE; | 700 | instr->state = MTD_ERASE_DONE; |
700 | mtd_erase_callback(instr); | 701 | mtd_erase_callback(instr); |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 0bcc71539b16..47b19c0bb070 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, | |||
2550 | if (check_offs_len(mtd, instr->addr, instr->len)) | 2550 | if (check_offs_len(mtd, instr->addr, instr->len)) |
2551 | return -EINVAL; | 2551 | return -EINVAL; |
2552 | 2552 | ||
2553 | instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN; | ||
2554 | |||
2555 | /* Grab the lock and see if the device is available */ | 2553 | /* Grab the lock and see if the device is available */ |
2556 | nand_get_device(chip, mtd, FL_ERASING); | 2554 | nand_get_device(chip, mtd, FL_ERASING); |
2557 | 2555 | ||
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 3d781b87b358..b3ce12ef359e 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) | |||
2502 | return -EINVAL; | 2502 | return -EINVAL; |
2503 | } | 2503 | } |
2504 | 2504 | ||
2505 | instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN; | ||
2506 | |||
2507 | /* Grab the lock and see if the device is available */ | 2505 | /* Grab the lock and see if the device is available */ |
2508 | onenand_get_device(mtd, FL_ERASING); | 2506 | onenand_get_device(mtd, FL_ERASING); |
2509 | 2507 | ||