Commit 8084b372 authored by Dominik Brodowski's avatar Dominik Brodowski
Browse files

[PATCH] pcmcia: kzalloc conversion



Convert users of kmalloc and memset to kzalloc
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent 6423efaa
......@@ -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;
/*
......
......@@ -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++);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
/*
......
......@@ -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);
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment