aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/chips
diff options
context:
space:
mode:
authorBurman Yan <yan_952@hotmail.com>2006-11-15 14:10:29 -0500
committerDavid Woodhouse <dwmw2@infradead.org>2006-11-28 18:47:21 -0500
commit95b93a0cd46682c6d9e8eea803fda510cb6b863a (patch)
tree7e430d3fc04ed20791187d144730dd3052292c67 /drivers/mtd/chips
parent998a43e72d20afa7566dad66fd866fe939a89c09 (diff)
[MTD] replace kmalloc+memset with kzalloc
Signed-off-by: Yan Burman <yan_952@hotmail.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/chips')
-rw-r--r--drivers/mtd/chips/amd_flash.c3
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c3
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0002.c3
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0020.c3
-rw-r--r--drivers/mtd/chips/gen_probe.c3
-rw-r--r--drivers/mtd/chips/jedec.c3
-rw-r--r--drivers/mtd/chips/map_absent.c4
-rw-r--r--drivers/mtd/chips/map_ram.c4
-rw-r--r--drivers/mtd/chips/map_rom.c4
-rw-r--r--drivers/mtd/chips/sharp.c7
10 files changed, 11 insertions, 26 deletions
diff --git a/drivers/mtd/chips/amd_flash.c b/drivers/mtd/chips/amd_flash.c
index 16eaca69fb5a..e7999f15d85a 100644
--- a/drivers/mtd/chips/amd_flash.c
+++ b/drivers/mtd/chips/amd_flash.c
@@ -643,13 +643,12 @@ static struct mtd_info *amd_flash_probe(struct map_info *map)
643 int reg_idx; 643 int reg_idx;
644 int offset; 644 int offset;
645 645
646 mtd = (struct mtd_info*)kmalloc(sizeof(*mtd), GFP_KERNEL); 646 mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
647 if (!mtd) { 647 if (!mtd) {
648 printk(KERN_WARNING 648 printk(KERN_WARNING
649 "%s: kmalloc failed for info structure\n", map->name); 649 "%s: kmalloc failed for info structure\n", map->name);
650 return NULL; 650 return NULL;
651 } 651 }
652 memset(mtd, 0, sizeof(*mtd));
653 mtd->priv = map; 652 mtd->priv = map;
654 653
655 memset(&temp, 0, sizeof(temp)); 654 memset(&temp, 0, sizeof(temp));
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index e24973636e61..11de54535526 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -337,12 +337,11 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
337 struct mtd_info *mtd; 337 struct mtd_info *mtd;
338 int i; 338 int i;
339 339
340 mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); 340 mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
341 if (!mtd) { 341 if (!mtd) {
342 printk(KERN_ERR "Failed to allocate memory for MTD device\n"); 342 printk(KERN_ERR "Failed to allocate memory for MTD device\n");
343 return NULL; 343 return NULL;
344 } 344 }
345 memset(mtd, 0, sizeof(*mtd));
346 mtd->priv = map; 345 mtd->priv = map;
347 mtd->type = MTD_NORFLASH; 346 mtd->type = MTD_NORFLASH;
348 347
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index ca0882b5819f..e3acd398fb37 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -257,12 +257,11 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
257 struct mtd_info *mtd; 257 struct mtd_info *mtd;
258 int i; 258 int i;
259 259
260 mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); 260 mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
261 if (!mtd) { 261 if (!mtd) {
262 printk(KERN_WARNING "Failed to allocate memory for MTD device\n"); 262 printk(KERN_WARNING "Failed to allocate memory for MTD device\n");
263 return NULL; 263 return NULL;
264 } 264 }
265 memset(mtd, 0, sizeof(*mtd));
266 mtd->priv = map; 265 mtd->priv = map;
267 mtd->type = MTD_NORFLASH; 266 mtd->type = MTD_NORFLASH;
268 267
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
index fae70a5db540..d56849f5f107 100644
--- a/drivers/mtd/chips/cfi_cmdset_0020.c
+++ b/drivers/mtd/chips/cfi_cmdset_0020.c
@@ -172,7 +172,7 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map)
172 int i,j; 172 int i,j;
173 unsigned long devsize = (1<<cfi->cfiq->DevSize) * cfi->interleave; 173 unsigned long devsize = (1<<cfi->cfiq->DevSize) * cfi->interleave;
174 174
175 mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); 175 mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
176 //printk(KERN_DEBUG "number of CFI chips: %d\n", cfi->numchips); 176 //printk(KERN_DEBUG "number of CFI chips: %d\n", cfi->numchips);
177 177
178 if (!mtd) { 178 if (!mtd) {
@@ -181,7 +181,6 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map)
181 return NULL; 181 return NULL;
182 } 182 }
183 183
184 memset(mtd, 0, sizeof(*mtd));
185 mtd->priv = map; 184 mtd->priv = map;
186 mtd->type = MTD_NORFLASH; 185 mtd->type = MTD_NORFLASH;
187 mtd->size = devsize * cfi->numchips; 186 mtd->size = devsize * cfi->numchips;
diff --git a/drivers/mtd/chips/gen_probe.c b/drivers/mtd/chips/gen_probe.c
index cdb0f590b40c..77843d560ae4 100644
--- a/drivers/mtd/chips/gen_probe.c
+++ b/drivers/mtd/chips/gen_probe.c
@@ -113,13 +113,12 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi
113 } 113 }
114 114
115 mapsize = (max_chips + BITS_PER_LONG-1) / BITS_PER_LONG; 115 mapsize = (max_chips + BITS_PER_LONG-1) / BITS_PER_LONG;
116 chip_map = kmalloc(mapsize, GFP_KERNEL); 116 chip_map = kzalloc(mapsize, GFP_KERNEL);
117 if (!chip_map) { 117 if (!chip_map) {
118 printk(KERN_WARNING "%s: kmalloc failed for CFI chip map\n", map->name); 118 printk(KERN_WARNING "%s: kmalloc failed for CFI chip map\n", map->name);
119 kfree(cfi.cfiq); 119 kfree(cfi.cfiq);
120 return NULL; 120 return NULL;
121 } 121 }
122 memset (chip_map, 0, mapsize);
123 122
124 set_bit(0, chip_map); /* Mark first chip valid */ 123 set_bit(0, chip_map); /* Mark first chip valid */
125 124
diff --git a/drivers/mtd/chips/jedec.c b/drivers/mtd/chips/jedec.c
index 2c3f019197c1..14e57b2bf842 100644
--- a/drivers/mtd/chips/jedec.c
+++ b/drivers/mtd/chips/jedec.c
@@ -116,11 +116,10 @@ static struct mtd_info *jedec_probe(struct map_info *map)
116 char Part[200]; 116 char Part[200];
117 memset(&priv,0,sizeof(priv)); 117 memset(&priv,0,sizeof(priv));
118 118
119 MTD = kmalloc(sizeof(struct mtd_info) + sizeof(struct jedec_private), GFP_KERNEL); 119 MTD = kzalloc(sizeof(struct mtd_info) + sizeof(struct jedec_private), GFP_KERNEL);
120 if (!MTD) 120 if (!MTD)
121 return NULL; 121 return NULL;
122 122
123 memset(MTD, 0, sizeof(struct mtd_info) + sizeof(struct jedec_private));
124 priv = (struct jedec_private *)&MTD[1]; 123 priv = (struct jedec_private *)&MTD[1];
125 124
126 my_bank_size = map->size; 125 my_bank_size = map->size;
diff --git a/drivers/mtd/chips/map_absent.c b/drivers/mtd/chips/map_absent.c
index ac01a949b687..fc478c0f93f5 100644
--- a/drivers/mtd/chips/map_absent.c
+++ b/drivers/mtd/chips/map_absent.c
@@ -47,13 +47,11 @@ static struct mtd_info *map_absent_probe(struct map_info *map)
47{ 47{
48 struct mtd_info *mtd; 48 struct mtd_info *mtd;
49 49
50 mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); 50 mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
51 if (!mtd) { 51 if (!mtd) {
52 return NULL; 52 return NULL;
53 } 53 }
54 54
55 memset(mtd, 0, sizeof(*mtd));
56
57 map->fldrv = &map_absent_chipdrv; 55 map->fldrv = &map_absent_chipdrv;
58 mtd->priv = map; 56 mtd->priv = map;
59 mtd->name = map->name; 57 mtd->name = map->name;
diff --git a/drivers/mtd/chips/map_ram.c b/drivers/mtd/chips/map_ram.c
index 3a66680abfd0..5cb6d5263661 100644
--- a/drivers/mtd/chips/map_ram.c
+++ b/drivers/mtd/chips/map_ram.c
@@ -55,12 +55,10 @@ static struct mtd_info *map_ram_probe(struct map_info *map)
55#endif 55#endif
56 /* OK. It seems to be RAM. */ 56 /* OK. It seems to be RAM. */
57 57
58 mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); 58 mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
59 if (!mtd) 59 if (!mtd)
60 return NULL; 60 return NULL;
61 61
62 memset(mtd, 0, sizeof(*mtd));
63
64 map->fldrv = &mapram_chipdrv; 62 map->fldrv = &mapram_chipdrv;
65 mtd->priv = map; 63 mtd->priv = map;
66 mtd->name = map->name; 64 mtd->name = map->name;
diff --git a/drivers/mtd/chips/map_rom.c b/drivers/mtd/chips/map_rom.c
index 1b328b1378fd..cb27f855074c 100644
--- a/drivers/mtd/chips/map_rom.c
+++ b/drivers/mtd/chips/map_rom.c
@@ -31,12 +31,10 @@ static struct mtd_info *map_rom_probe(struct map_info *map)
31{ 31{
32 struct mtd_info *mtd; 32 struct mtd_info *mtd;
33 33
34 mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); 34 mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
35 if (!mtd) 35 if (!mtd)
36 return NULL; 36 return NULL;
37 37
38 memset(mtd, 0, sizeof(*mtd));
39
40 map->fldrv = &maprom_chipdrv; 38 map->fldrv = &maprom_chipdrv;
41 mtd->priv = map; 39 mtd->priv = map;
42 mtd->name = map->name; 40 mtd->name = map->name;
diff --git a/drivers/mtd/chips/sharp.c b/drivers/mtd/chips/sharp.c
index 967abbecdff9..c9cd3d21ccfa 100644
--- a/drivers/mtd/chips/sharp.c
+++ b/drivers/mtd/chips/sharp.c
@@ -112,18 +112,16 @@ static struct mtd_info *sharp_probe(struct map_info *map)
112 struct sharp_info *sharp = NULL; 112 struct sharp_info *sharp = NULL;
113 int width; 113 int width;
114 114
115 mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); 115 mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
116 if(!mtd) 116 if(!mtd)
117 return NULL; 117 return NULL;
118 118
119 sharp = kmalloc(sizeof(*sharp), GFP_KERNEL); 119 sharp = kzalloc(sizeof(*sharp), GFP_KERNEL);
120 if(!sharp) { 120 if(!sharp) {
121 kfree(mtd); 121 kfree(mtd);
122 return NULL; 122 return NULL;
123 } 123 }
124 124
125 memset(mtd, 0, sizeof(*mtd));
126
127 width = sharp_probe_map(map,mtd); 125 width = sharp_probe_map(map,mtd);
128 if(!width){ 126 if(!width){
129 kfree(mtd); 127 kfree(mtd);
@@ -143,7 +141,6 @@ static struct mtd_info *sharp_probe(struct map_info *map)
143 mtd->writesize = 1; 141 mtd->writesize = 1;
144 mtd->name = map->name; 142 mtd->name = map->name;
145 143
146 memset(sharp, 0, sizeof(*sharp));
147 sharp->chipshift = 23; 144 sharp->chipshift = 23;
148 sharp->numchips = 1; 145 sharp->numchips = 1;
149 sharp->chips[0].start = 0; 146 sharp->chips[0].start = 0;