aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-12-11 21:18:26 +0100
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-06 00:28:06 +0100
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 0868b72c399..971a3528164 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,
struct skt_dev_info *sinfo;
int ret, i;
- sinfo = kmalloc(sizeof(struct skt_dev_info), GFP_KERNEL);
+ sinfo = kzalloc(sizeof(struct skt_dev_info), GFP_KERNEL);
if (!sinfo) {
ret = -ENOMEM;
goto out;
}
- memset(sinfo, 0, sizeof(struct skt_dev_info));
sinfo->nskt = nr;
/*
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 0fc61dd1d4d..0252582b91c 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)
if (fw->size >= CISTPL_MAX_CIS_SIZE)
goto release;
- cis = kmalloc(sizeof(cisdump_t), GFP_KERNEL);
+ cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL);
if (!cis)
goto release;
- memset(cis, 0, sizeof(cisdump_t));
-
cis->Length = fw->size + 1;
memcpy(cis->Data, fw->data, fw->size);
@@ -387,13 +385,12 @@ static int pcmcia_device_probe(struct device * dev)
s->functions = mfc.nfn;
else
s->functions = 1;
- s->config = kmalloc(sizeof(config_t) * s->functions,
+ s->config = kzalloc(sizeof(config_t) * s->functions,
GFP_KERNEL);
if (!s->config) {
ret = -ENOMEM;
goto put_module;
}
- memset(s->config, 0, sizeof(config_t) * s->functions);
}
ret = p_drv->probe(p_dev);
@@ -572,10 +569,9 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
if (s->device_count == 2)
goto err_put;
- p_dev = kmalloc(sizeof(struct pcmcia_device), GFP_KERNEL);
+ p_dev = kzalloc(sizeof(struct pcmcia_device), GFP_KERNEL);
if (!p_dev)
goto err_put;
- memset(p_dev, 0, sizeof(struct pcmcia_device));
p_dev->socket = s;
p_dev->device_no = (s->device_count++);
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c
index e7a6d9ac5ed..f2789afb22b 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,
char configbyte;
struct pd6729_socket *socket;
- socket = kmalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS,
+ socket = kzalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS,
GFP_KERNEL);
if (!socket)
return -ENOMEM;
- memset(socket, 0, sizeof(struct pd6729_socket) * MAX_SOCKETS);
-
if ((ret = pci_enable_device(dev)))
goto err_out_free_mem;
diff --git a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c
index 5209d8c7764..5d957dfe23d 100644
--- a/drivers/pcmcia/pxa2xx_mainstone.c
+++ b/drivers/pcmcia/pxa2xx_mainstone.c
@@ -171,10 +171,9 @@ static int __init mst_pcmcia_init(void)
{
int ret;
- mst_pcmcia_device = kmalloc(sizeof(*mst_pcmcia_device), GFP_KERNEL);
+ mst_pcmcia_device = kzalloc(sizeof(*mst_pcmcia_device), GFP_KERNEL);
if (!mst_pcmcia_device)
return -ENOMEM;
- memset(mst_pcmcia_device, 0, sizeof(*mst_pcmcia_device));
mst_pcmcia_device->name = "pxa2xx-pcmcia";
mst_pcmcia_device->dev.platform_data = &mst_pcmcia_ops;
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c
index 56c58831e80..b5fdeec20b1 100644
--- a/drivers/pcmcia/pxa2xx_sharpsl.c
+++ b/drivers/pcmcia/pxa2xx_sharpsl.c
@@ -264,11 +264,10 @@ static int __init sharpsl_pcmcia_init(void)
int ret;
sharpsl_pcmcia_ops.nr=platform_scoop_config->num_devs;
- sharpsl_pcmcia_device = kmalloc(sizeof(*sharpsl_pcmcia_device), GFP_KERNEL);
+ sharpsl_pcmcia_device = kzalloc(sizeof(*sharpsl_pcmcia_device), GFP_KERNEL);
if (!sharpsl_pcmcia_device)
return -ENOMEM;
- memset(sharpsl_pcmcia_device, 0, sizeof(*sharpsl_pcmcia_device));
sharpsl_pcmcia_device->name = "pxa2xx-pcmcia";
sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops;
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 6b18092205b..5301ac60358 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -75,10 +75,9 @@ static DECLARE_MUTEX(rsrc_sem);
static struct resource *
make_resource(unsigned long b, unsigned long n, int flags, char *name)
{
- struct resource *res = kmalloc(sizeof(*res), GFP_KERNEL);
+ struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL);
if (res) {
- memset(res, 0, sizeof(*res));
res->name = name;
res->start = b;
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
base, base+num-1);
/* First, what does a floating port look like? */
- b = kmalloc(256, GFP_KERNEL);
+ b = kzalloc(256, GFP_KERNEL);
if (!b) {
printk(KERN_ERR "do_io_probe: unable to kmalloc 256 bytes");
return;
}
- memset(b, 0, 256);
for (i = base, most = 0; i < base+num; i += 8) {
res = claim_region(NULL, i, 8, IORESOURCE_IO, "PCMCIA IO probe");
if (!res)
@@ -850,10 +848,9 @@ static int nonstatic_init(struct pcmcia_socket *s)
{
struct socket_data *data;
- data = kmalloc(sizeof(struct socket_data), GFP_KERNEL);
+ data = kzalloc(sizeof(struct socket_data), GFP_KERNEL);
if (!data)
return -ENOMEM;
- memset(data, 0, sizeof(struct socket_data));
data->mem_db.next = &data->mem_db;
data->io_db.next = &data->io_db;
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index a563bd9a889..ea7d9ca160b 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
down(&soc_pcmcia_sockets_lock);
- sinfo = kmalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL);
+ sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL);
if (!sinfo) {
ret = -ENOMEM;
goto out;
}
- memset(sinfo, 0, SKT_DEV_INFO_SIZE(nr));
sinfo->nskt = nr;
/*
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c
index e074bc1f101..7a7744662d5 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
if (!(s->state & SOCKET_PRESENT))
return -ENODEV;
- cis = kmalloc(sizeof(cisdump_t), GFP_KERNEL);
+ cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL);
if (!cis)
return -ENOMEM;
- memset(cis, 0, sizeof(cisdump_t));
cis->Length = count + 1;
memcpy(cis->Data, buf, count);
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 826e7e13326..4145eb83b9b 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
return -ENODEV;
}
- socket = kmalloc(sizeof(struct yenta_socket), GFP_KERNEL);
+ socket = kzalloc(sizeof(struct yenta_socket), GFP_KERNEL);
if (!socket)
return -ENOMEM;
- memset(socket, 0, sizeof(*socket));
/* prepare pcmcia_socket */
socket->socket.ops = &yenta_socket_operations;