Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: use vzalloc

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Joe Perches and committed by
David Woodhouse
309b5e4e 08b3af30

+3 -6
+1 -2
drivers/mtd/nand/nandsim.c
··· 470 470 err = -EINVAL; 471 471 goto err_close; 472 472 } 473 - ns->pages_written = vmalloc(ns->geom.pgnum); 473 + ns->pages_written = vzalloc(ns->geom.pgnum); 474 474 if (!ns->pages_written) { 475 475 NS_ERR("alloc_device: unable to allocate pages written array\n"); 476 476 err = -ENOMEM; ··· 483 483 goto err_free; 484 484 } 485 485 ns->cfile = cfile; 486 - memset(ns->pages_written, 0, ns->geom.pgnum); 487 486 return 0; 488 487 } 489 488
+2 -4
drivers/mtd/ubi/vtbl.c
··· 425 425 426 426 /* Read both LEB 0 and LEB 1 into memory */ 427 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 429 if (!leb[seb->lnum]) { 430 430 err = -ENOMEM; 431 431 goto out_free; 432 432 } 433 - memset(leb[seb->lnum], 0, ubi->vtbl_size); 434 433 435 434 err = ubi_io_read_data(ubi, leb[seb->lnum], seb->pnum, 0, 436 435 ubi->vtbl_size); ··· 515 516 int i; 516 517 struct ubi_vtbl_record *vtbl; 517 518 518 - vtbl = vmalloc(ubi->vtbl_size); 519 + vtbl = vzalloc(ubi->vtbl_size); 519 520 if (!vtbl) 520 521 return ERR_PTR(-ENOMEM); 521 - memset(vtbl, 0, ubi->vtbl_size); 522 522 523 523 for (i = 0; i < ubi->vtbl_slots; i++) 524 524 memcpy(&vtbl[i], &empty_vtbl_record, UBI_VTBL_RECORD_SIZE);