aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/wl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/wl.c')
-rw-r--r--drivers/mtd/ubi/wl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 42c684cf3688..0696e36b0539 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -795,7 +795,10 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
795 protect = 1; 795 protect = 1;
796 goto out_not_moved; 796 goto out_not_moved;
797 } 797 }
798 798 if (err == MOVE_RETRY) {
799 scrubbing = 1;
800 goto out_not_moved;
801 }
799 if (err == MOVE_CANCEL_BITFLIPS || err == MOVE_TARGET_WR_ERR || 802 if (err == MOVE_CANCEL_BITFLIPS || err == MOVE_TARGET_WR_ERR ||
800 err == MOVE_TARGET_RD_ERR) { 803 err == MOVE_TARGET_RD_ERR) {
801 /* 804 /*
@@ -1049,7 +1052,6 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
1049 1052
1050 ubi_err("failed to erase PEB %d, error %d", pnum, err); 1053 ubi_err("failed to erase PEB %d, error %d", pnum, err);
1051 kfree(wl_wrk); 1054 kfree(wl_wrk);
1052 kmem_cache_free(ubi_wl_entry_slab, e);
1053 1055
1054 if (err == -EINTR || err == -ENOMEM || err == -EAGAIN || 1056 if (err == -EINTR || err == -ENOMEM || err == -EAGAIN ||
1055 err == -EBUSY) { 1057 err == -EBUSY) {
@@ -1062,14 +1064,16 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
1062 goto out_ro; 1064 goto out_ro;
1063 } 1065 }
1064 return err; 1066 return err;
1065 } else if (err != -EIO) { 1067 }
1068
1069 kmem_cache_free(ubi_wl_entry_slab, e);
1070 if (err != -EIO)
1066 /* 1071 /*
1067 * If this is not %-EIO, we have no idea what to do. Scheduling 1072 * If this is not %-EIO, we have no idea what to do. Scheduling
1068 * this physical eraseblock for erasure again would cause 1073 * this physical eraseblock for erasure again would cause
1069 * errors again and again. Well, lets switch to R/O mode. 1074 * errors again and again. Well, lets switch to R/O mode.
1070 */ 1075 */
1071 goto out_ro; 1076 goto out_ro;
1072 }
1073 1077
1074 /* It is %-EIO, the PEB went bad */ 1078 /* It is %-EIO, the PEB went bad */
1075 1079