aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/ubi/wl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 277c429a138f..0696e36b0539 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1052,7 +1052,6 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
1052 1052
1053 ubi_err("failed to erase PEB %d, error %d", pnum, err); 1053 ubi_err("failed to erase PEB %d, error %d", pnum, err);
1054 kfree(wl_wrk); 1054 kfree(wl_wrk);
1055 kmem_cache_free(ubi_wl_entry_slab, e);
1056 1055
1057 if (err == -EINTR || err == -ENOMEM || err == -EAGAIN || 1056 if (err == -EINTR || err == -ENOMEM || err == -EAGAIN ||
1058 err == -EBUSY) { 1057 err == -EBUSY) {
@@ -1065,14 +1064,16 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
1065 goto out_ro; 1064 goto out_ro;
1066 } 1065 }
1067 return err; 1066 return err;
1068 } else if (err != -EIO) { 1067 }
1068
1069 kmem_cache_free(ubi_wl_entry_slab, e);
1070 if (err != -EIO)
1069 /* 1071 /*
1070 * 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
1071 * this physical eraseblock for erasure again would cause 1073 * this physical eraseblock for erasure again would cause
1072 * errors again and again. Well, lets switch to R/O mode. 1074 * errors again and again. Well, lets switch to R/O mode.
1073 */ 1075 */
1074 goto out_ro; 1076 goto out_ro;
1075 }
1076 1077
1077 /* It is %-EIO, the PEB went bad */ 1078 /* It is %-EIO, the PEB went bad */
1078 1079