diff options
author | Julia Lawall <julia@diku.dk> | 2010-05-13 16:03:15 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-05-13 16:23:06 -0400 |
commit | 2bfefa4c9632fb09bfe3277cf7b690818b147654 (patch) | |
tree | 9ddbd55e57e266dfea47e38fa007f47731fed8fb /drivers/mtd/tests/mtd_readtest.c | |
parent | ecce2a6f9bdc7635838baeff8a09a76c9a70e7e0 (diff) |
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/tests/mtd_readtest.c')
-rw-r--r-- | drivers/mtd/tests/mtd_readtest.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/mtd/tests/mtd_readtest.c b/drivers/mtd/tests/mtd_readtest.c index 7107fccbc7de..afe71aa15c4b 100644 --- a/drivers/mtd/tests/mtd_readtest.c +++ b/drivers/mtd/tests/mtd_readtest.c | |||
@@ -141,12 +141,11 @@ static int scan_for_bad_eraseblocks(void) | |||
141 | { | 141 | { |
142 | int i, bad = 0; | 142 | int i, bad = 0; |
143 | 143 | ||
144 | bbt = kmalloc(ebcnt, GFP_KERNEL); | 144 | bbt = kzalloc(ebcnt, GFP_KERNEL); |
145 | if (!bbt) { | 145 | if (!bbt) { |
146 | printk(PRINT_PREF "error: cannot allocate memory\n"); | 146 | printk(PRINT_PREF "error: cannot allocate memory\n"); |
147 | return -ENOMEM; | 147 | return -ENOMEM; |
148 | } | 148 | } |
149 | memset(bbt, 0 , ebcnt); | ||
150 | 149 | ||
151 | /* NOR flash does not implement block_isbad */ | 150 | /* NOR flash does not implement block_isbad */ |
152 | if (mtd->block_isbad == NULL) | 151 | if (mtd->block_isbad == NULL) |