aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r--drivers/mtd/ubi/eba.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 1f7375e2ffb8..7ce91ca742b1 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -862,6 +862,17 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol,
862 if (ubi->ro_mode) 862 if (ubi->ro_mode)
863 return -EROFS; 863 return -EROFS;
864 864
865 if (len == 0) {
866 /*
867 * Special case when data length is zero. In this case the LEB
868 * has to be unmapped and mapped somewhere else.
869 */
870 err = ubi_eba_unmap_leb(ubi, vol, lnum);
871 if (err)
872 return err;
873 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0, dtype);
874 }
875
865 vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS); 876 vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS);
866 if (!vid_hdr) 877 if (!vid_hdr)
867 return -ENOMEM; 878 return -ENOMEM;