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.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index fcdb7f65fe0b..0b8141fc5c26 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -425,12 +425,11 @@ static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi,
425 425
426 /* Read both LEB 0 and LEB 1 into memory */ 426 /* Read both LEB 0 and LEB 1 into memory */
427 ubi_rb_for_each_entry(rb, seb, &sv->root, u.rb) { 427 ubi_rb_for_each_entry(rb, seb, &sv->root, u.rb) {
428 leb[seb->lnum] = vmalloc(ubi->vtbl_size); 428 leb[seb->lnum] = vzalloc(ubi->vtbl_size);
429 if (!leb[seb->lnum]) { 429 if (!leb[seb->lnum]) {
430 err = -ENOMEM; 430 err = -ENOMEM;
431 goto out_free; 431 goto out_free;
432 } 432 }
433 memset(leb[seb->lnum], 0, ubi->vtbl_size);
434 433
435 err = ubi_io_read_data(ubi, leb[seb->lnum], seb->pnum, 0, 434 err = ubi_io_read_data(ubi, leb[seb->lnum], seb->pnum, 0,
436 ubi->vtbl_size); 435 ubi->vtbl_size);
@@ -516,10 +515,9 @@ static struct ubi_vtbl_record *create_empty_lvol(struct ubi_device *ubi,
516 int i; 515 int i;
517 struct ubi_vtbl_record *vtbl; 516 struct ubi_vtbl_record *vtbl;
518 517
519 vtbl = vmalloc(ubi->vtbl_size); 518 vtbl = vzalloc(ubi->vtbl_size);
520 if (!vtbl) 519 if (!vtbl)
521 return ERR_PTR(-ENOMEM); 520 return ERR_PTR(-ENOMEM);
522 memset(vtbl, 0, ubi->vtbl_size);
523 521
524 for (i = 0; i < ubi->vtbl_slots; i++) 522 for (i = 0; i < ubi->vtbl_slots; i++)
525 memcpy(&vtbl[i], &empty_vtbl_record, UBI_VTBL_RECORD_SIZE); 523 memcpy(&vtbl[i], &empty_vtbl_record, UBI_VTBL_RECORD_SIZE);