diff options
Diffstat (limited to 'drivers/mtd/ubi/eba.c')
-rw-r--r-- | drivers/mtd/ubi/eba.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index 2ff34923e51d..84f7dc9fd3ac 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c | |||
@@ -301,6 +301,8 @@ int ubi_eba_unmap_leb(struct ubi_device *ubi, struct ubi_volume *vol, | |||
301 | { | 301 | { |
302 | int err, pnum, vol_id = vol->vol_id; | 302 | int err, pnum, vol_id = vol->vol_id; |
303 | 303 | ||
304 | ubi_assert(vol->ref_count > 0); | ||
305 | |||
304 | if (ubi->ro_mode) | 306 | if (ubi->ro_mode) |
305 | return -EROFS; | 307 | return -EROFS; |
306 | 308 | ||
@@ -349,6 +351,8 @@ int ubi_eba_read_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, | |||
349 | struct ubi_vid_hdr *vid_hdr; | 351 | struct ubi_vid_hdr *vid_hdr; |
350 | uint32_t uninitialized_var(crc); | 352 | uint32_t uninitialized_var(crc); |
351 | 353 | ||
354 | ubi_assert(vol->ref_count > 0); | ||
355 | |||
352 | err = leb_read_lock(ubi, vol_id, lnum); | 356 | err = leb_read_lock(ubi, vol_id, lnum); |
353 | if (err) | 357 | if (err) |
354 | return err; | 358 | return err; |
@@ -572,6 +576,8 @@ int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, | |||
572 | int err, pnum, tries = 0, vol_id = vol->vol_id; | 576 | int err, pnum, tries = 0, vol_id = vol->vol_id; |
573 | struct ubi_vid_hdr *vid_hdr; | 577 | struct ubi_vid_hdr *vid_hdr; |
574 | 578 | ||
579 | ubi_assert(vol->ref_count > 0); | ||
580 | |||
575 | if (ubi->ro_mode) | 581 | if (ubi->ro_mode) |
576 | return -EROFS; | 582 | return -EROFS; |
577 | 583 | ||
@@ -705,6 +711,8 @@ int ubi_eba_write_leb_st(struct ubi_device *ubi, struct ubi_volume *vol, | |||
705 | struct ubi_vid_hdr *vid_hdr; | 711 | struct ubi_vid_hdr *vid_hdr; |
706 | uint32_t crc; | 712 | uint32_t crc; |
707 | 713 | ||
714 | ubi_assert(vol->ref_count > 0); | ||
715 | |||
708 | if (ubi->ro_mode) | 716 | if (ubi->ro_mode) |
709 | return -EROFS; | 717 | return -EROFS; |
710 | 718 | ||
@@ -819,6 +827,8 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, | |||
819 | struct ubi_vid_hdr *vid_hdr; | 827 | struct ubi_vid_hdr *vid_hdr; |
820 | uint32_t crc; | 828 | uint32_t crc; |
821 | 829 | ||
830 | ubi_assert(vol->ref_count > 0); | ||
831 | |||
822 | if (ubi->ro_mode) | 832 | if (ubi->ro_mode) |
823 | return -EROFS; | 833 | return -EROFS; |
824 | 834 | ||