[PATCH 05/22] UBI: Fastmap: Rework ubi_wl_put_fm_peb()
Richard Weinberger
richard at nod.at
Mon Jun 18 12:18:48 EDT 2012
Signed-off-by: Richard Weinberger <richard at nod.at>
---
drivers/mtd/ubi/wl.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index a64cd83..369e07f 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -827,13 +827,14 @@ static int do_sync_erase(struct ubi_device *ubi, struct ubi_wl_entry *e,
*
* see: ubi_wl_put_peb()
*/
-int ubi_wl_put_fm_peb(struct ubi_device *ubi, struct ubi_wl_entry *used_e,
- int torture)
+int ubi_wl_put_fm_peb(struct ubi_device *ubi, struct ubi_wl_entry *fm_e,
+ int torture)
{
struct ubi_wl_entry *e;
- int pnum = used_e->pnum;
+ int pnum = fm_e->pnum;
dbg_wl("PEB %d", pnum);
+
ubi_assert(pnum >= 0);
ubi_assert(pnum < ubi->peb_count);
@@ -845,11 +846,11 @@ int ubi_wl_put_fm_peb(struct ubi_device *ubi, struct ubi_wl_entry *used_e,
* has never seen any PEB used by the original fastmap.
*/
if (!e) {
- e = used_e;
-
+ e = fm_e;
ubi_assert(e->ec);
ubi->lookuptbl[pnum] = e;
- }
+ } else
+ kfree(fm_e);
spin_unlock(&ubi->wl_lock);
--
1.7.6.5
More information about the linux-mtd
mailing list