Skip to content

Commit

Permalink
mtd: docprobe: use kzalloc instead
Browse files Browse the repository at this point in the history
Instead of calling 'kmalloc()' and them 'memeset(0)', use 'kzalloc()'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Artem Bityutskiy authored and David Woodhouse committed Jan 9, 2012
1 parent a88d2dc commit 122f81d
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/mtd/devices/docprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,19 +241,14 @@ static void __init DoC_Probe(unsigned long physadr)
return;
}
docfound = 1;
mtd = kmalloc(sizeof(struct DiskOnChip) + sizeof(struct mtd_info), GFP_KERNEL);

mtd = kzalloc(sizeof(struct DiskOnChip) + sizeof(struct mtd_info), GFP_KERNEL);
if (!mtd) {
printk(KERN_WARNING "Cannot allocate memory for data structures. Dropping.\n");
iounmap(docptr);
return;
}

this = (struct DiskOnChip *)(&mtd[1]);

memset((char *)mtd,0, sizeof(struct mtd_info));
memset((char *)this, 0, sizeof(struct DiskOnChip));

mtd->priv = this;
this->virtadr = docptr;
this->physadr = physadr;
Expand Down

0 comments on commit 122f81d

Please sign in to comment.