aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/ubi/eba.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index a1820151e9f9..0db8dc7af8a0 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -891,11 +891,13 @@ retry:
891 goto write_error; 891 goto write_error;
892 } 892 }
893 893
894 err = ubi_wl_put_peb(ubi, vol->eba_tbl[lnum], 1); 894 if (vol->eba_tbl[lnum] >= 0) {
895 if (err) { 895 err = ubi_wl_put_peb(ubi, vol->eba_tbl[lnum], 1);
896 ubi_free_vid_hdr(ubi, vid_hdr); 896 if (err) {
897 leb_write_unlock(ubi, vol_id, lnum); 897 ubi_free_vid_hdr(ubi, vid_hdr);
898 return err; 898 leb_write_unlock(ubi, vol_id, lnum);
899 return err;
900 }
899 } 901 }
900 902
901 vol->eba_tbl[lnum] = pnum; 903 vol->eba_tbl[lnum] = pnum;