aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-12-11 15:18:26 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 18:28:06 -0500
commit8084b372adac9c24ff7abdd939b2e8816e7b88a3 (patch)
treea4a4005d7b025abc0a3e7693404abd0abbfd434b
parent6423efaacbf0bce6372897e793d8450c1c08ec8d (diff)
[PATCH] pcmcia: kzalloc conversion
Convert users of kmalloc and memset to kzalloc Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r--drivers/pcmcia/au1000_generic.c3
-rw-r--r--drivers/pcmcia/ds.c10
-rw-r--r--drivers/pcmcia/pd6729.c4
-rw-r--r--drivers/pcmcia/pxa2xx_mainstone.c3
-rw-r--r--drivers/pcmcia/pxa2xx_sharpsl.c3
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c9
-rw-r--r--drivers/pcmcia/soc_common.c3
-rw-r--r--drivers/pcmcia/socket_sysfs.c3
-rw-r--r--drivers/pcmcia/yenta_socket.c3
9 files changed, 13 insertions, 28 deletions
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c
index 0868b72c3996..971a35281649 100644
--- a/drivers/pcmcia/au1000_generic.c
+++ b/drivers/pcmcia/au1000_generic.c
@@ -354,13 +354,12 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
354 struct skt_dev_info *sinfo; 354 struct skt_dev_info *sinfo;
355 int ret, i; 355 int ret, i;
356 356
357 sinfo = kmalloc(sizeof(struct skt_dev_info), GFP_KERNEL); 357 sinfo = kzalloc(sizeof(struct skt_dev_info), GFP_KERNEL);
358 if (!sinfo) { 358 if (!sinfo) {
359 ret = -ENOMEM; 359 ret = -ENOMEM;
360 goto out; 360 goto out;
361 } 361 }
362 362
363 memset(sinfo, 0, sizeof(struct skt_dev_info));
364 sinfo->nskt = nr; 363 sinfo->nskt = nr;
365 364
366 /* 365 /*
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 0fc61dd1d4d0..0252582b91cd 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -264,12 +264,10 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
264 if (fw->size >= CISTPL_MAX_CIS_SIZE) 264 if (fw->size >= CISTPL_MAX_CIS_SIZE)
265 goto release; 265 goto release;
266 266
267 cis = kmalloc(sizeof(cisdump_t), GFP_KERNEL); 267 cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL);
268 if (!cis) 268 if (!cis)
269 goto release; 269 goto release;
270 270
271 memset(cis, 0, sizeof(cisdump_t));
272
273 cis->Length = fw->size + 1; 271 cis->Length = fw->size + 1;
274 memcpy(cis->Data, fw->data, fw->size); 272 memcpy(cis->Data, fw->data, fw->size);
275 273
@@ -387,13 +385,12 @@ static int pcmcia_device_probe(struct device * dev)
387 s->functions = mfc.nfn; 385 s->functions = mfc.nfn;
388 else 386 else
389 s->functions = 1; 387 s->functions = 1;
390 s->config = kmalloc(sizeof(config_t) * s->functions, 388 s->config = kzalloc(sizeof(config_t) * s->functions,
391 GFP_KERNEL); 389 GFP_KERNEL);
392 if (!s->config) { 390 if (!s->config) {
393 ret = -ENOMEM; 391 ret = -ENOMEM;
394 goto put_module; 392 goto put_module;
395 } 393 }
396 memset(s->config, 0, sizeof(config_t) * s->functions);
397 } 394 }
398 395
399 ret = p_drv->probe(p_dev); 396 ret = p_drv->probe(p_dev);
@@ -572,10 +569,9 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
572 if (s->device_count == 2) 569 if (s->device_count == 2)
573 goto err_put; 570 goto err_put;
574 571
575 p_dev = kmalloc(sizeof(struct pcmcia_device), GFP_KERNEL); 572 p_dev = kzalloc(sizeof(struct pcmcia_device), GFP_KERNEL);
576 if (!p_dev) 573 if (!p_dev)
577 goto err_put; 574 goto err_put;
578 memset(p_dev, 0, sizeof(struct pcmcia_device));
579 575
580 p_dev->socket = s; 576 p_dev->socket = s;
581 p_dev->device_no = (s->device_count++); 577 p_dev->device_no = (s->device_count++);
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c
index e7a6d9ac5ed8..f2789afb22b2 100644
--- a/drivers/pcmcia/pd6729.c
+++ b/drivers/pcmcia/pd6729.c
@@ -634,13 +634,11 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
634 char configbyte; 634 char configbyte;
635 struct pd6729_socket *socket; 635 struct pd6729_socket *socket;
636 636
637 socket = kmalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS, 637 socket = kzalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS,
638 GFP_KERNEL); 638 GFP_KERNEL);
639 if (!socket) 639 if (!socket)
640 return -ENOMEM; 640 return -ENOMEM;
641 641
642 memset(socket, 0, sizeof(struct pd6729_socket) * MAX_SOCKETS);
643
644 if ((ret = pci_enable_device(dev))) 642 if ((ret = pci_enable_device(dev)))
645 goto err_out_free_mem; 643 goto err_out_free_mem;
646 644
diff --git a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c
index 5209d8c7764f..5d957dfe23d9 100644
--- a/drivers/pcmcia/pxa2xx_mainstone.c
+++ b/drivers/pcmcia/pxa2xx_mainstone.c
@@ -171,10 +171,9 @@ static int __init mst_pcmcia_init(void)
171{ 171{
172 int ret; 172 int ret;
173 173
174 mst_pcmcia_device = kmalloc(sizeof(*mst_pcmcia_device), GFP_KERNEL); 174 mst_pcmcia_device = kzalloc(sizeof(*mst_pcmcia_device), GFP_KERNEL);
175 if (!mst_pcmcia_device) 175 if (!mst_pcmcia_device)
176 return -ENOMEM; 176 return -ENOMEM;
177 memset(mst_pcmcia_device, 0, sizeof(*mst_pcmcia_device));
178 mst_pcmcia_device->name = "pxa2xx-pcmcia"; 177 mst_pcmcia_device->name = "pxa2xx-pcmcia";
179 mst_pcmcia_device->dev.platform_data = &mst_pcmcia_ops; 178 mst_pcmcia_device->dev.platform_data = &mst_pcmcia_ops;
180 179
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c
index 56c58831e80e..b5fdeec20b15 100644
--- a/drivers/pcmcia/pxa2xx_sharpsl.c
+++ b/drivers/pcmcia/pxa2xx_sharpsl.c
@@ -264,11 +264,10 @@ static int __init sharpsl_pcmcia_init(void)
264 int ret; 264 int ret;
265 265
266 sharpsl_pcmcia_ops.nr=platform_scoop_config->num_devs; 266 sharpsl_pcmcia_ops.nr=platform_scoop_config->num_devs;
267 sharpsl_pcmcia_device = kmalloc(sizeof(*sharpsl_pcmcia_device), GFP_KERNEL); 267 sharpsl_pcmcia_device = kzalloc(sizeof(*sharpsl_pcmcia_device), GFP_KERNEL);
268 if (!sharpsl_pcmcia_device) 268 if (!sharpsl_pcmcia_device)
269 return -ENOMEM; 269 return -ENOMEM;
270 270
271 memset(sharpsl_pcmcia_device, 0, sizeof(*sharpsl_pcmcia_device));
272 sharpsl_pcmcia_device->name = "pxa2xx-pcmcia"; 271 sharpsl_pcmcia_device->name = "pxa2xx-pcmcia";
273 sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops; 272 sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops;
274 sharpsl_pcmcia_device->dev.parent=platform_scoop_config->devs[0].dev; 273 sharpsl_pcmcia_device->dev.parent=platform_scoop_config->devs[0].dev;
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index 6b18092205b1..5301ac60358f 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -75,10 +75,9 @@ static DECLARE_MUTEX(rsrc_sem);
75static struct resource * 75static struct resource *
76make_resource(unsigned long b, unsigned long n, int flags, char *name) 76make_resource(unsigned long b, unsigned long n, int flags, char *name)
77{ 77{
78 struct resource *res = kmalloc(sizeof(*res), GFP_KERNEL); 78 struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL);
79 79
80 if (res) { 80 if (res) {
81 memset(res, 0, sizeof(*res));
82 res->name = name; 81 res->name = name;
83 res->start = b; 82 res->start = b;
84 res->end = b + n - 1; 83 res->end = b + n - 1;
@@ -200,12 +199,11 @@ static void do_io_probe(struct pcmcia_socket *s, kio_addr_t base, kio_addr_t num
200 base, base+num-1); 199 base, base+num-1);
201 200
202 /* First, what does a floating port look like? */ 201 /* First, what does a floating port look like? */
203 b = kmalloc(256, GFP_KERNEL); 202 b = kzalloc(256, GFP_KERNEL);
204 if (!b) { 203 if (!b) {
205 printk(KERN_ERR "do_io_probe: unable to kmalloc 256 bytes"); 204 printk(KERN_ERR "do_io_probe: unable to kmalloc 256 bytes");
206 return; 205 return;
207 } 206 }
208 memset(b, 0, 256);
209 for (i = base, most = 0; i < base+num; i += 8) { 207 for (i = base, most = 0; i < base+num; i += 8) {
210 res = claim_region(NULL, i, 8, IORESOURCE_IO, "PCMCIA IO probe"); 208 res = claim_region(NULL, i, 8, IORESOURCE_IO, "PCMCIA IO probe");
211 if (!res) 209 if (!res)
@@ -850,10 +848,9 @@ static int nonstatic_init(struct pcmcia_socket *s)
850{ 848{
851 struct socket_data *data; 849 struct socket_data *data;
852 850
853 data = kmalloc(sizeof(struct socket_data), GFP_KERNEL); 851 data = kzalloc(sizeof(struct socket_data), GFP_KERNEL);
854 if (!data) 852 if (!data)
855 return -ENOMEM; 853 return -ENOMEM;
856 memset(data, 0, sizeof(struct socket_data));
857 854
858 data->mem_db.next = &data->mem_db; 855 data->mem_db.next = &data->mem_db;
859 data->io_db.next = &data->io_db; 856 data->io_db.next = &data->io_db;
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index a563bd9a8898..ea7d9ca160b2 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -645,13 +645,12 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops
645 645
646 down(&soc_pcmcia_sockets_lock); 646 down(&soc_pcmcia_sockets_lock);
647 647
648 sinfo = kmalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL); 648 sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL);
649 if (!sinfo) { 649 if (!sinfo) {
650 ret = -ENOMEM; 650 ret = -ENOMEM;
651 goto out; 651 goto out;
652 } 652 }
653 653
654 memset(sinfo, 0, SKT_DEV_INFO_SIZE(nr));
655 sinfo->nskt = nr; 654 sinfo->nskt = nr;
656 655
657 /* 656 /*
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c
index e074bc1f101f..7a7744662d54 100644
--- a/drivers/pcmcia/socket_sysfs.c
+++ b/drivers/pcmcia/socket_sysfs.c
@@ -285,10 +285,9 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz
285 if (!(s->state & SOCKET_PRESENT)) 285 if (!(s->state & SOCKET_PRESENT))
286 return -ENODEV; 286 return -ENODEV;
287 287
288 cis = kmalloc(sizeof(cisdump_t), GFP_KERNEL); 288 cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL);
289 if (!cis) 289 if (!cis)
290 return -ENOMEM; 290 return -ENOMEM;
291 memset(cis, 0, sizeof(cisdump_t));
292 291
293 cis->Length = count + 1; 292 cis->Length = count + 1;
294 memcpy(cis->Data, buf, count); 293 memcpy(cis->Data, buf, count);
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 826e7e133269..4145eb83b9b6 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -1019,10 +1019,9 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1019 return -ENODEV; 1019 return -ENODEV;
1020 } 1020 }
1021 1021
1022 socket = kmalloc(sizeof(struct yenta_socket), GFP_KERNEL); 1022 socket = kzalloc(sizeof(struct yenta_socket), GFP_KERNEL);
1023 if (!socket) 1023 if (!socket)
1024 return -ENOMEM; 1024 return -ENOMEM;
1025 memset(socket, 0, sizeof(*socket));
1026 1025
1027 /* prepare pcmcia_socket */ 1026 /* prepare pcmcia_socket */
1028 socket->socket.ops = &yenta_socket_operations; 1027 socket->socket.ops = &yenta_socket_operations;