public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mtd: docprobe: use kzalloc instead
@ 2011-12-29 15:47 Artem Bityutskiy
  2011-12-29 15:47 ` [PATCH 2/2] mtd: doc: do not initialize mtd_info fields to 0 or NULL Artem Bityutskiy
  2011-12-29 21:31 ` [PATCH 1/2] mtd: docprobe: use kzalloc instead Thomas Petazzoni
  0 siblings, 2 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2011-12-29 15:47 UTC (permalink / raw)
  To: linux-mtd

From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

Instead of calling 'kmalloc()' and them 'memeset(0)', use 'kzalloc()'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.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..31b84aa 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 = kzmalloc(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;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-29 21:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-29 15:47 [PATCH 1/2] mtd: docprobe: use kzalloc instead Artem Bityutskiy
2011-12-29 15:47 ` [PATCH 2/2] mtd: doc: do not initialize mtd_info fields to 0 or NULL Artem Bityutskiy
2011-12-29 21:31 ` [PATCH 1/2] mtd: docprobe: use kzalloc instead Thomas Petazzoni
2011-12-29 21:38   ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox