aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/vtbl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/vtbl.c')
-rw-r--r--drivers/mtd/ubi/vtbl.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index fd3bf770f518..4b50a3029b84 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -307,8 +307,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_scan_info *si,
307{ 307{
308 int err, tries = 0; 308 int err, tries = 0;
309 static struct ubi_vid_hdr *vid_hdr; 309 static struct ubi_vid_hdr *vid_hdr;
310 struct ubi_scan_volume *sv; 310 struct ubi_scan_leb *new_seb;
311 struct ubi_scan_leb *new_seb, *old_seb = NULL;
312 311
313 ubi_msg("create volume table (copy #%d)", copy + 1); 312 ubi_msg("create volume table (copy #%d)", copy + 1);
314 313
@@ -316,15 +315,6 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_scan_info *si,
316 if (!vid_hdr) 315 if (!vid_hdr)
317 return -ENOMEM; 316 return -ENOMEM;
318 317
319 /*
320 * Check if there is a logical eraseblock which would have to contain
321 * this volume table copy was found during scanning. It has to be wiped
322 * out.
323 */
324 sv = ubi_scan_find_sv(si, UBI_LAYOUT_VOLUME_ID);
325 if (sv)
326 old_seb = ubi_scan_find_seb(sv, copy);
327
328retry: 318retry:
329 new_seb = ubi_scan_get_free_peb(ubi, si); 319 new_seb = ubi_scan_get_free_peb(ubi, si);
330 if (IS_ERR(new_seb)) { 320 if (IS_ERR(new_seb)) {
@@ -351,8 +341,8 @@ retry:
351 goto write_error; 341 goto write_error;
352 342
353 /* 343 /*
354 * And add it to the scanning information. Don't delete the old 344 * And add it to the scanning information. Don't delete the old version
355 * @old_seb as it will be deleted and freed in 'ubi_scan_add_used()'. 345 * of this LEB as it will be deleted and freed in 'ubi_scan_add_used()'.
356 */ 346 */
357 err = ubi_scan_add_used(ubi, si, new_seb->pnum, new_seb->ec, 347 err = ubi_scan_add_used(ubi, si, new_seb->pnum, new_seb->ec,
358 vid_hdr, 0); 348 vid_hdr, 0);
@@ -876,7 +866,7 @@ out_free:
876 */ 866 */
877static void paranoid_vtbl_check(const struct ubi_device *ubi) 867static void paranoid_vtbl_check(const struct ubi_device *ubi)
878{ 868{
879 if (!(ubi_chk_flags & UBI_CHK_GEN)) 869 if (!ubi->dbg->chk_gen)
880 return; 870 return;
881 871
882 if (vtbl_check(ubi, ubi->vtbl)) { 872 if (vtbl_check(ubi, ubi->vtbl)) {