UBI: Set free_count to zero before walking through erase list
authorHeiko Schocher <hs@denx.de>
Fri, 22 Apr 2016 10:06:38 +0000 (12:06 +0200)
committerRichard Weinberger <richard@nod.at>
Tue, 24 May 2016 13:24:33 +0000 (15:24 +0200)
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>
drivers/mtd/ubi/wl.c

index 17ec948ac40e5c63fd8f16608ee503bc7aeee5f0..959c7b12e0b1be4863960e43fa9dfbe67f2eb58a 100644 (file)
@@ -1534,6 +1534,7 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
                INIT_LIST_HEAD(&ubi->pq[i]);
        ubi->pq_head = 0;
 
+       ubi->free_count = 0;
        list_for_each_entry_safe(aeb, tmp, &ai->erase, u.list) {
                cond_resched();
 
@@ -1552,7 +1553,6 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
                found_pebs++;
        }
 
-       ubi->free_count = 0;
        list_for_each_entry(aeb, &ai->free, u.list) {
                cond_resched();
 
This page took 0.036067 seconds and 5 git commands to generate.