aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2016-04-22 06:06:38 -0400
committerRichard Weinberger <richard@nod.at>2016-05-24 09:24:33 -0400
commit73b0cd57fcd07201b138214f9a2353f76dd9ae2c (patch)
tree3daf450d9453a750700cedf5e58c05cb4edcb178
parent24663e7281b8fbfaae22467ec2625e2bffe07815 (diff)
UBI: Set free_count to zero before walking through erase list
Set free_count to zero before walking through ai->erase list in wl_init(). Found in U-Boot as U-Boot has no workqueue/threads, it immediately calls erase_worker(), which increase for each erased block free_count. Without this patch, free_count gets after this initialized to zero in wl_init(), so the free_count variable always has the maybe wrong value 0 in U-Boot. Signed-off-by: Heiko Schocher <hs@denx.de> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--drivers/mtd/ubi/wl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 17ec948ac40e..959c7b12e0b1 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1534,6 +1534,7 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
1534 INIT_LIST_HEAD(&ubi->pq[i]); 1534 INIT_LIST_HEAD(&ubi->pq[i]);
1535 ubi->pq_head = 0; 1535 ubi->pq_head = 0;
1536 1536
1537 ubi->free_count = 0;
1537 list_for_each_entry_safe(aeb, tmp, &ai->erase, u.list) { 1538 list_for_each_entry_safe(aeb, tmp, &ai->erase, u.list) {
1538 cond_resched(); 1539 cond_resched();
1539 1540
@@ -1552,7 +1553,6 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
1552 found_pebs++; 1553 found_pebs++;
1553 } 1554 }
1554 1555
1555 ubi->free_count = 0;
1556 list_for_each_entry(aeb, &ai->free, u.list) { 1556 list_for_each_entry(aeb, &ai->free, u.list) {
1557 cond_resched(); 1557 cond_resched();
1558 1558