Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95b93a0c authored by Burman Yan's avatar Burman Yan Committed by David Woodhouse
Browse files

[MTD] replace kmalloc+memset with kzalloc

parent 998a43e7
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -358,13 +358,12 @@ ev64360_setup_mtd(void)

	ptbl_entries = 3;

	if ((ptbl = kmalloc(ptbl_entries * sizeof(struct mtd_partition),
	if ((ptbl = kzalloc(ptbl_entries * sizeof(struct mtd_partition),
		GFP_KERNEL)) == NULL) {

		printk(KERN_WARNING "Can't alloc MTD partition table\n");
		return -ENOMEM;
	}
	memset(ptbl, 0, ptbl_entries * sizeof(struct mtd_partition));

	ptbl[0].name = "reserved";
	ptbl[0].offset = 0;
+1 −2
Original line number Diff line number Diff line
@@ -207,11 +207,10 @@ static int parse_afs_partitions(struct mtd_info *mtd,
	if (!sz)
		return ret;

	parts = kmalloc(sz, GFP_KERNEL);
	parts = kzalloc(sz, GFP_KERNEL);
	if (!parts)
		return -ENOMEM;

	memset(parts, 0, sz);
	str = (char *)(parts + idx);

	/*
+1 −2
Original line number Diff line number Diff line
@@ -643,13 +643,12 @@ static struct mtd_info *amd_flash_probe(struct map_info *map)
	int reg_idx;
	int offset;

	mtd = (struct mtd_info*)kmalloc(sizeof(*mtd), GFP_KERNEL);
	mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
	if (!mtd) {
		printk(KERN_WARNING
		       "%s: kmalloc failed for info structure\n", map->name);
		return NULL;
	}
	memset(mtd, 0, sizeof(*mtd));
	mtd->priv = map;

	memset(&temp, 0, sizeof(temp));
+1 −2
Original line number Diff line number Diff line
@@ -337,12 +337,11 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
	struct mtd_info *mtd;
	int i;

	mtd = kmalloc(sizeof(*mtd), GFP_KERNEL);
	mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
	if (!mtd) {
		printk(KERN_ERR "Failed to allocate memory for MTD device\n");
		return NULL;
	}
	memset(mtd, 0, sizeof(*mtd));
	mtd->priv = map;
	mtd->type = MTD_NORFLASH;

+1 −2
Original line number Diff line number Diff line
@@ -257,12 +257,11 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
	struct mtd_info *mtd;
	int i;

	mtd = kmalloc(sizeof(*mtd), GFP_KERNEL);
	mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
	if (!mtd) {
		printk(KERN_WARNING "Failed to allocate memory for MTD device\n");
		return NULL;
	}
	memset(mtd, 0, sizeof(*mtd));
	mtd->priv = map;
	mtd->type = MTD_NORFLASH;

Loading