···163163 *num_parts = this_part + 1;164164 alloc_size = *num_parts * sizeof(struct mtd_partition) +165165 extra_mem_size;166166- parts = kmalloc(alloc_size, GFP_KERNEL);166166+ parts = kzalloc(alloc_size, GFP_KERNEL);167167 if (!parts)168168 {169169 printk(KERN_ERR ERRP "out of memory\n");170170 return NULL;171171 }172172- memset(parts, 0, alloc_size);173172 extra_mem = (unsigned char *)(parts + *num_parts);174173 }175174 /* enter this partition (offset will be calculated later if it is zero at this point) */
+1-2
drivers/mtd/devices/block2mtd.c
···295295 if (!devname)296296 return NULL;297297298298- dev = kmalloc(sizeof(struct block2mtd_dev), GFP_KERNEL);298298+ dev = kzalloc(sizeof(struct block2mtd_dev), GFP_KERNEL);299299 if (!dev)300300 return NULL;301301- memset(dev, 0, sizeof(*dev));302301303302 /* Get a handle on the device */304303 bdev = open_bdev_excl(devname, O_RDWR, NULL);
···126126 struct phram_mtd_list *new;127127 int ret = -ENOMEM;128128129129- new = kmalloc(sizeof(*new), GFP_KERNEL);129129+ new = kzalloc(sizeof(*new), GFP_KERNEL);130130 if (!new)131131 goto out0;132132-133133- memset(new, 0, sizeof(*new));134132135133 ret = -EIO;136134 new->mtd.priv = ioremap(start, len);
···67676868 DEBUG(MTD_DEBUG_LEVEL3, "INFTL: add_mtd for %s\n", mtd->name);69697070- inftl = kmalloc(sizeof(*inftl), GFP_KERNEL);7070+ inftl = kzalloc(sizeof(*inftl), GFP_KERNEL);71717272 if (!inftl) {7373 printk(KERN_WARNING "INFTL: Out of memory for data structures\n");7474 return;7575 }7676- memset(inftl, 0, sizeof(*inftl));77767877 inftl->mbd.mtd = mtd;7978 inftl->mbd.devnum = -1;
+1-2
drivers/mtd/maps/ceiva.c
···122122 /*123123 * Allocate the map_info structs in one go.124124 */125125- maps = kmalloc(sizeof(struct map_info) * nr, GFP_KERNEL);125125+ maps = kzalloc(sizeof(struct map_info) * nr, GFP_KERNEL);126126 if (!maps)127127 return -ENOMEM;128128- memset(maps, 0, sizeof(struct map_info) * nr);129128 /*130129 * Claim and then map the memory regions.131130 */
+1-3
drivers/mtd/maps/integrator-flash.c
···7575 int err;7676 void __iomem *base;77777878- info = kmalloc(sizeof(struct armflash_info), GFP_KERNEL);7878+ info = kzalloc(sizeof(struct armflash_info), GFP_KERNEL);7979 if (!info) {8080 err = -ENOMEM;8181 goto out;8282 }8383-8484- memset(info, 0, sizeof(struct armflash_info));85838684 info->plat = plat;8785 if (plat && plat->init) {
+1-3
drivers/mtd/maps/omap_nor.c
···7878 struct resource *res = pdev->resource;7979 unsigned long size = res->end - res->start + 1;80808181- info = kmalloc(sizeof(struct omapflash_info), GFP_KERNEL);8181+ info = kzalloc(sizeof(struct omapflash_info), GFP_KERNEL);8282 if (!info)8383 return -ENOMEM;8484-8585- memset(info, 0, sizeof(struct omapflash_info));86848785 if (!request_mem_region(res->start, size, "flash")) {8886 err = -EBUSY;
+1-2
drivers/mtd/maps/pcmciamtd.c
···735735 struct pcmciamtd_dev *dev;736736737737 /* Create new memory card device */738738- dev = kmalloc(sizeof(*dev), GFP_KERNEL);738738+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);739739 if (!dev) return -ENOMEM;740740 DEBUG(1, "dev=0x%p", dev);741741742742- memset(dev, 0, sizeof(*dev));743742 dev->p_dev = link;744743 link->priv = dev;745744
+1-2
drivers/mtd/maps/physmap.c
···9292 (unsigned long long)(dev->resource->end - dev->resource->start + 1),9393 (unsigned long long)dev->resource->start);94949595- info = kmalloc(sizeof(struct physmap_flash_info), GFP_KERNEL);9595+ info = kzalloc(sizeof(struct physmap_flash_info), GFP_KERNEL);9696 if (info == NULL) {9797 err = -ENOMEM;9898 goto err_out;9999 }100100- memset(info, 0, sizeof(*info));101100102101 platform_set_drvdata(dev, info);103102
+1-2
drivers/mtd/maps/plat-ram.c
···147147148148 pdata = pdev->dev.platform_data;149149150150- info = kmalloc(sizeof(*info), GFP_KERNEL);150150+ info = kzalloc(sizeof(*info), GFP_KERNEL);151151 if (info == NULL) {152152 dev_err(&pdev->dev, "no memory for flash info\n");153153 err = -ENOMEM;154154 goto exit_error;155155 }156156157157- memset(info, 0, sizeof(*info));158157 platform_set_drvdata(pdev, info);159158160159 info->dev = &pdev->dev;
+1-3
drivers/mtd/maps/sa1100-flash.c
···273273 /*274274 * Allocate the map_info structs in one go.275275 */276276- info = kmalloc(size, GFP_KERNEL);276276+ info = kzalloc(size, GFP_KERNEL);277277 if (!info) {278278 ret = -ENOMEM;279279 goto out;280280 }281281-282282- memset(info, 0, size);283281284282 if (plat->init) {285283 ret = plat->init();
···323323 for (i = 0; i < nbparts; i++) {324324325325 /* allocate the partition structure */326326- slave = kmalloc (sizeof(*slave), GFP_KERNEL);326326+ slave = kzalloc (sizeof(*slave), GFP_KERNEL);327327 if (!slave) {328328 printk ("memory allocation error while creating partitions for \"%s\"\n",329329 master->name);330330 del_mtd_partitions(master);331331 return -ENOMEM;332332 }333333- memset(slave, 0, sizeof(*slave));334333 list_add(&slave->list, &mtd_partitions);335334336335 /* set up the MTD object for this partition */
···960960 struct nand_bbt_descr *md = this->bbt_md;961961962962 len = mtd->size >> (this->bbt_erase_shift + 2);963963- /* Allocate memory (2bit per block) */964964- this->bbt = kmalloc(len, GFP_KERNEL);963963+ /* Allocate memory (2bit per block) and clear the memory bad block table */964964+ this->bbt = kzalloc(len, GFP_KERNEL);965965 if (!this->bbt) {966966 printk(KERN_ERR "nand_scan_bbt: Out of memory\n");967967 return -ENOMEM;968968 }969969- /* Clear the memory bad block table */970970- memset(this->bbt, 0x00, len);971969972970 /* If no primary table decriptor is given, scan the device973971 * to build a memory based bad block table