[PATCH 05/22] UBI: Fastmap: Rework ubi_wl_put_fm_peb()

From: Richard Weinberger
Date: Mon Jun 18 2012 - 12:23:06 EST


Signed-off-by: Richard Weinberger <richard@xxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/