Patchwork [06/21] UBI: Fastmap: Ensure that new_fm->e[0]->ec is always set

login
register
mail settings
Submitter Richard Weinberger
Date June 13, 2012, 10:42 a.m.
Message ID <1339584138-69914-7-git-send-email-richard@nod.at>
Download mbox | patch
Permalink /patch/164620/
State New
Headers show

Comments

Richard Weinberger - June 13, 2012, 10:42 a.m.
Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/mtd/ubi/fastmap.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index a82a604..c2a1c18 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -1310,7 +1310,6 @@  int ubi_update_fastmap(struct ubi_device *ubi)
 			}
 
 			new_fm->e[0]->pnum = old_fm->e[0]->pnum;
-			new_fm->e[0]->ec = old_fm->e[0]->ec;
 		} else {
 			/* we've got a new early PEB, return the old one */
 			ubi_wl_put_fm_peb(ubi, old_fm->e[0], 0);
@@ -1326,9 +1325,10 @@  int ubi_update_fastmap(struct ubi_device *ubi)
 
 			goto err;
 		}
-		new_fm->e[0]->ec = get_ec(ubi, new_fm->e[0]->pnum);
 	}
 
+	new_fm->e[0]->ec = get_ec(ubi, new_fm->e[0]->pnum);
+
 	if (new_fm->used_blocks > UBI_FM_MAX_BLOCKS) {
 		ubi_err("fastmap too large");
 		ret = -ENOSPC;