]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
UBI: bugfix in ubi_leb_change()
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 21 May 2007 17:26:05 +0000 (20:26 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 18 Jul 2007 13:53:57 +0000 (16:53 +0300)
Do not call 'ubi_wl_put_peb()' if the LEB was unmapped.

Reported-by: Gabor Loki <loki@inf.u-szeged.hu>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
drivers/mtd/ubi/eba.c

index a1820151e9f9f9855fddd5a7f08dcfa103fcf257..0db8dc7af8a0107f98152cc66b20bb29b6c7332b 100644 (file)
@@ -891,11 +891,13 @@ retry:
                goto write_error;
        }
 
-       err = ubi_wl_put_peb(ubi, vol->eba_tbl[lnum], 1);
-       if (err) {
-               ubi_free_vid_hdr(ubi, vid_hdr);
-               leb_write_unlock(ubi, vol_id, lnum);
-               return err;
+       if (vol->eba_tbl[lnum] >= 0) {
+               err = ubi_wl_put_peb(ubi, vol->eba_tbl[lnum], 1);
+               if (err) {
+                       ubi_free_vid_hdr(ubi, vid_hdr);
+                       leb_write_unlock(ubi, vol_id, lnum);
+                       return err;
+               }
        }
 
        vol->eba_tbl[lnum] = pnum;