diff options
author | Julia Lawall <julia@diku.dk> | 2010-05-13 22:03:15 +0200 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-05-13 21:23:06 +0100 |
commit | 2bfefa4c9632fb09bfe3277cf7b690818b147654 (patch) | |
tree | 9ddbd55e57e266dfea47e38fa007f47731fed8fb /drivers/mtd/maps | |
parent | ecce2a6f9bdc7635838baeff8a09a76c9a70e7e0 (diff) | |
download | kernel_samsung_smdk4412-2bfefa4c9632fb09bfe3277cf7b690818b147654.zip kernel_samsung_smdk4412-2bfefa4c9632fb09bfe3277cf7b690818b147654.tar.gz kernel_samsung_smdk4412-2bfefa4c9632fb09bfe3277cf7b690818b147654.tar.bz2 |
drivers/mtd: Use kzalloc
Use kzalloc rather than the combination of kmalloc and memset.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,size,flags;
statement S;
@@
-x = kmalloc(size,flags);
+x = kzalloc(size,flags);
if (x == NULL) S
-memset(x, 0, size);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r-- | drivers/mtd/maps/ixp2000.c | 3 | ||||
-rw-r--r-- | drivers/mtd/maps/ixp4xx.c | 3 | ||||
-rw-r--r-- | drivers/mtd/maps/pxa2xx-flash.c | 3 |
3 files changed, 3 insertions, 6 deletions
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c index 1bdf0ee..9639d83 100644 --- a/drivers/mtd/maps/ixp2000.c +++ b/drivers/mtd/maps/ixp2000.c @@ -165,12 +165,11 @@ static int ixp2000_flash_probe(struct platform_device *dev) return -EIO; } - info = kmalloc(sizeof(struct ixp2000_flash_info), GFP_KERNEL); + info = kzalloc(sizeof(struct ixp2000_flash_info), GFP_KERNEL); if(!info) { err = -ENOMEM; goto Error; } - memset(info, 0, sizeof(struct ixp2000_flash_info)); platform_set_drvdata(dev, info); diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index 7513d90..e0a5e04 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c @@ -196,12 +196,11 @@ static int ixp4xx_flash_probe(struct platform_device *dev) return err; } - info = kmalloc(sizeof(struct ixp4xx_flash_info), GFP_KERNEL); + info = kzalloc(sizeof(struct ixp4xx_flash_info), GFP_KERNEL); if(!info) { err = -ENOMEM; goto Error; } - memset(info, 0, sizeof(struct ixp4xx_flash_info)); platform_set_drvdata(dev, info); diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c index 91dc633..dd90880 100644 --- a/drivers/mtd/maps/pxa2xx-flash.c +++ b/drivers/mtd/maps/pxa2xx-flash.c @@ -63,11 +63,10 @@ static int __init pxa2xx_flash_probe(struct platform_device *pdev) if (!res) return -ENODEV; - info = kmalloc(sizeof(struct pxa2xx_flash_info), GFP_KERNEL); + info = kzalloc(sizeof(struct pxa2xx_flash_info), GFP_KERNEL); if (!info) return -ENOMEM; - memset(info, 0, sizeof(struct pxa2xx_flash_info)); info->map.name = (char *) flash->name; info->map.bankwidth = flash->width; info->map.phys = res->start; |