[Patch 07/16] Remove unnecessary kmalloc casts in the mtd drivers.

From: jack
Date: Tue Jul 31 2007 - 09:13:41 EST


Signed-off-by: Jack Stone <jack@xxxxxxxxxxxxxxxxxxxxxxx>

CC: David Woodhouse <dwmw2@xxxxxxxxxxxxx>

---
drivers/mtd/maps/pmcmsp-flash.c | 11 ++++-------
drivers/mtd/maps/tqm8xxl.c | 2 +-
2 files changed, 5 insertions(+), 8 deletions(-)

Index: b/drivers/mtd/maps/pmcmsp-flash.c
===================================================================
--- a/drivers/mtd/maps/pmcmsp-flash.c
+++ b/drivers/mtd/maps/pmcmsp-flash.c
@@ -73,12 +73,9 @@ int __init init_msp_flash(void)
return -ENXIO;

printk(KERN_NOTICE "Found %d PMC flash devices\n", fcnt);
- msp_flash = (struct mtd_info **)kmalloc(
- fcnt * sizeof(struct map_info *), GFP_KERNEL);
- msp_parts = (struct mtd_partition **)kmalloc(
- fcnt * sizeof(struct mtd_partition *), GFP_KERNEL);
- msp_maps = (struct map_info *)kmalloc(
- fcnt * sizeof(struct mtd_info), GFP_KERNEL);
+ msp_flash = kmalloc(fcnt * sizeof(struct map_info *), GFP_KERNEL);
+ msp_parts = kmalloc(fcnt * sizeof(struct mtd_partition *), GFP_KERNEL);
+ msp_maps = kmalloc(fcnt * sizeof(struct mtd_info), GFP_KERNEL);
memset(msp_maps, 0, fcnt * sizeof(struct mtd_info));

/* loop over the flash devices, initializing each */
@@ -95,7 +92,7 @@ int __init init_msp_flash(void)
continue;
}

- msp_parts[i] = (struct mtd_partition *)kmalloc(
+ msp_parts[i] = kmalloc(
pcnt * sizeof(struct mtd_partition), GFP_KERNEL);
memset(msp_parts[i], 0, pcnt * sizeof(struct mtd_partition));

Index: b/drivers/mtd/maps/tqm8xxl.c
===================================================================
--- a/drivers/mtd/maps/tqm8xxl.c
+++ b/drivers/mtd/maps/tqm8xxl.c
@@ -141,7 +141,7 @@ int __init init_tqm_mtd(void)
goto error_mem;
}

- map_banks[idx]->name = (char *)kmalloc(16, GFP_KERNEL);
+ map_banks[idx]->name = kmalloc(16, GFP_KERNEL);

if (!map_banks[idx]->name) {
ret = -ENOMEM;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/