|
@@ -1052,7 +1052,6 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
|
|
|
|
|
|
ubi_err("failed to erase PEB %d, error %d", pnum, err);
|
|
|
kfree(wl_wrk);
|
|
|
- kmem_cache_free(ubi_wl_entry_slab, e);
|
|
|
|
|
|
if (err == -EINTR || err == -ENOMEM || err == -EAGAIN ||
|
|
|
err == -EBUSY) {
|
|
@@ -1065,14 +1064,16 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
|
|
|
goto out_ro;
|
|
|
}
|
|
|
return err;
|
|
|
- } else if (err != -EIO) {
|
|
|
+ }
|
|
|
+
|
|
|
+ kmem_cache_free(ubi_wl_entry_slab, e);
|
|
|
+ if (err != -EIO)
|
|
|
/*
|
|
|
* If this is not %-EIO, we have no idea what to do. Scheduling
|
|
|
* this physical eraseblock for erasure again would cause
|
|
|
* errors again and again. Well, lets switch to R/O mode.
|
|
|
*/
|
|
|
goto out_ro;
|
|
|
- }
|
|
|
|
|
|
/* It is %-EIO, the PEB went bad */
|
|
|
|