diff options
Diffstat (limited to 'drivers/mtd/ubi/vtbl.c')
-rw-r--r-- | drivers/mtd/ubi/vtbl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c index 25b3bd61c7ec..3349c281bf9e 100644 --- a/drivers/mtd/ubi/vtbl.c +++ b/drivers/mtd/ubi/vtbl.c | |||
@@ -86,8 +86,10 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx, | |||
86 | { | 86 | { |
87 | int i, err; | 87 | int i, err; |
88 | uint32_t crc; | 88 | uint32_t crc; |
89 | struct ubi_volume *layout_vol; | ||
89 | 90 | ||
90 | ubi_assert(idx >= 0 && idx < ubi->vtbl_slots); | 91 | ubi_assert(idx >= 0 && idx < ubi->vtbl_slots); |
92 | layout_vol = ubi->volumes[vol_id2idx(UBI_LAYOUT_VOL_ID)]; | ||
91 | 93 | ||
92 | if (!vtbl_rec) | 94 | if (!vtbl_rec) |
93 | vtbl_rec = &empty_vtbl_record; | 95 | vtbl_rec = &empty_vtbl_record; |
@@ -99,12 +101,12 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx, | |||
99 | mutex_lock(&ubi->vtbl_mutex); | 101 | mutex_lock(&ubi->vtbl_mutex); |
100 | memcpy(&ubi->vtbl[idx], vtbl_rec, sizeof(struct ubi_vtbl_record)); | 102 | memcpy(&ubi->vtbl[idx], vtbl_rec, sizeof(struct ubi_vtbl_record)); |
101 | for (i = 0; i < UBI_LAYOUT_VOLUME_EBS; i++) { | 103 | for (i = 0; i < UBI_LAYOUT_VOLUME_EBS; i++) { |
102 | err = ubi_eba_unmap_leb(ubi, UBI_LAYOUT_VOL_ID, i); | 104 | err = ubi_eba_unmap_leb(ubi, layout_vol, i); |
103 | if (err) { | 105 | if (err) { |
104 | mutex_unlock(&ubi->vtbl_mutex); | 106 | mutex_unlock(&ubi->vtbl_mutex); |
105 | return err; | 107 | return err; |
106 | } | 108 | } |
107 | err = ubi_eba_write_leb(ubi, UBI_LAYOUT_VOL_ID, i, ubi->vtbl, 0, | 109 | err = ubi_eba_write_leb(ubi, layout_vol, i, ubi->vtbl, 0, |
108 | ubi->vtbl_size, UBI_LONGTERM); | 110 | ubi->vtbl_size, UBI_LONGTERM); |
109 | if (err) { | 111 | if (err) { |
110 | mutex_unlock(&ubi->vtbl_mutex); | 112 | mutex_unlock(&ubi->vtbl_mutex); |