mtd: docprobe: use kzalloc instead

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Jan 9 13:59:14 EST 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=122f81d773a464220d64f1a382bde073df281d5a
Commit:     122f81d773a464220d64f1a382bde073df281d5a
Parent:     a88d2dc672192247a6f42c82d558db9bf9258bed
Author:     Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
AuthorDate: Thu Dec 29 11:36:19 2011 +0200
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Jan 9 18:25:51 2012 +0000

    mtd: docprobe: use kzalloc instead
    
    Instead of calling 'kmalloc()' and them 'memeset(0)', use 'kzalloc()'.
    
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/devices/docprobe.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/devices/docprobe.c b/drivers/mtd/devices/docprobe.c
index 45116bb..706b847 100644
--- a/drivers/mtd/devices/docprobe.c
+++ b/drivers/mtd/devices/docprobe.c
@@ -241,8 +241,7 @@ 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);
@@ -250,10 +249,6 @@ static void __init DoC_Probe(unsigned long physadr)
 		}
 
 		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;



More information about the linux-mtd-cvs mailing list