Skip to contentSkip to conversation

replacing kmalloc with kzalloc in drivers/mtd/chips/cfi_probe.c

KJ-resend Surya Prabhakar N 2 participants 2 messages Aug 13, 2007 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi,
Replacing kmalloc with kzalloc and cleaning up memset in
drivers/mtd/chips/cfi_probe.c. Kindly ignore the previous similar patch.

---

drivers/mtd/chips/cfi_probe.c +1 -3
index 60e11a0..efb51f7 100644
@@ -203,14 +203,12 @@ static int __xipram cfi_chip_setup(struct map_info *map,
 	if (!num_erase_regions)
 		return 0;
 
-	cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
+	cfi->cfiq = kzalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
 	if (!cfi->cfiq) {
 		printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name);
 		return 0;
 	}
 
-	memset(cfi->cfiq,0,sizeof(struct cfi_ident));
-
 	cfi->cfi_mode = CFI_MODE_CFI;
 
 	/* Read the CFI info structure */

thanks
surya.

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com

#1 lore raw
Quoted 16 lines · Surya Prabhakar N

Hi,
Replacing kmalloc with kzalloc and cleaning up memset in
drivers/mtd/chips/cfi_probe.c. Kindly ignore the previous similar patch.

---

drivers/mtd/chips/cfi_probe.c +0 -0
index 60e11a0..efb51f7 100644
@@ -203,14 +203,12 @@ static int __xipram cfi_chip_setup(struct map_info *map,
 	if (!num_erase_regions)
 		return 0;
 

drivers/mtd/chips/cfi_probe.c static int __xipram cfi_chip_setup(struct map_info *map, · line 212

Quoted 10 lines
drivers/mtd/chips/cfi_probe.c +1 -3
-	cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
+	cfi->cfiq = kzalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
 	if (!cfi->cfiq) {
 		printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name);
 		return 0;
 	}
 
-	memset(cfi->cfiq,0,sizeof(struct cfi_ident));
-
 	cfi->cfi_mode = CFI_MODE_CFI;

but that change is not precisely equivalent, it now clears more than the original code. as long as that's not a problem.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================