* [PATH] Replace kmalloc+memset with kzalloc 6/17
@ 2006-11-12 17:27 Burman Yan
0 siblings, 0 replies; only message in thread
From: Burman Yan @ 2006-11-12 17:27 UTC (permalink / raw)
To: trivial; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 263 bytes --]
Part 6 of the kmalloc+memset to kzalloc patch
Yan Burman
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
[-- Attachment #2: kzalloc_drivers2.patch --]
[-- Type: application/octet-stream, Size: 27853 bytes --]
Replace kmalloc+memset with kzalloc
Patch 6/17
Signed-off-by: Yan Burman <yan_952@hotmail.com>
diff -rubp linux-2.6.19-rc5_orig/drivers/macintosh/macio_asic.c linux-2.6.19-rc5_kzalloc/drivers/macintosh/macio_asic.c
--- linux-2.6.19-rc5_orig/drivers/macintosh/macio_asic.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/macintosh/macio_asic.c 2006-11-11 22:44:04.000000000 +0200
@@ -461,10 +461,9 @@ static struct macio_dev * macio_add_one_
if (np == NULL)
return NULL;
- dev = kmalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev)
return NULL;
- memset(dev, 0, sizeof(*dev));
dev->bus = &chip->lbus;
dev->media_bay = in_bay;
diff -rubp linux-2.6.19-rc5_orig/drivers/macintosh/smu.c linux-2.6.19-rc5_kzalloc/drivers/macintosh/smu.c
--- linux-2.6.19-rc5_orig/drivers/macintosh/smu.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/macintosh/smu.c 2006-11-11 22:44:04.000000000 +0200
@@ -1052,10 +1052,9 @@ static int smu_open(struct inode *inode,
struct smu_private *pp;
unsigned long flags;
- pp = kmalloc(sizeof(struct smu_private), GFP_KERNEL);
+ pp = kzalloc(sizeof(struct smu_private), GFP_KERNEL);
if (pp == 0)
return -ENOMEM;
- memset(pp, 0, sizeof(struct smu_private));
spin_lock_init(&pp->lock);
pp->mode = smu_file_commands;
init_waitqueue_head(&pp->wait);
diff -rubp linux-2.6.19-rc5_orig/drivers/macintosh/therm_adt746x.c linux-2.6.19-rc5_kzalloc/drivers/macintosh/therm_adt746x.c
--- linux-2.6.19-rc5_orig/drivers/macintosh/therm_adt746x.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/macintosh/therm_adt746x.c 2006-11-11 22:44:04.000000000 +0200
@@ -379,12 +379,11 @@ static int attach_one_thermostat(struct
return 0;
th = (struct thermostat *)
- kmalloc(sizeof(struct thermostat), GFP_KERNEL);
+ kzalloc(sizeof(struct thermostat), GFP_KERNEL);
if (!th)
return -ENOMEM;
- memset(th, 0, sizeof(*th));
th->clt.addr = addr;
th->clt.adapter = adapter;
th->clt.driver = &thermostat_driver;
diff -rubp linux-2.6.19-rc5_orig/drivers/macintosh/therm_pm72.c linux-2.6.19-rc5_kzalloc/drivers/macintosh/therm_pm72.c
--- linux-2.6.19-rc5_orig/drivers/macintosh/therm_pm72.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/macintosh/therm_pm72.c 2006-11-11 22:44:04.000000000 +0200
@@ -318,10 +318,9 @@ static struct i2c_client *attach_i2c_chi
if (adap == NULL)
return NULL;
- clt = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+ clt = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (clt == NULL)
return NULL;
- memset(clt, 0, sizeof(struct i2c_client));
clt->addr = (id >> 1) & 0x7f;
clt->adapter = adap;
diff -rubp linux-2.6.19-rc5_orig/drivers/macintosh/therm_windtunnel.c linux-2.6.19-rc5_kzalloc/drivers/macintosh/therm_windtunnel.c
--- linux-2.6.19-rc5_orig/drivers/macintosh/therm_windtunnel.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/macintosh/therm_windtunnel.c 2006-11-11 22:44:04.000000000 +0200
@@ -430,9 +430,8 @@ do_probe( struct i2c_adapter *adapter, i
| I2C_FUNC_SMBUS_WRITE_BYTE) )
return 0;
- if( !(cl=kmalloc(sizeof(*cl), GFP_KERNEL)) )
+ if( !(cl=kzalloc(sizeof(*cl), GFP_KERNEL)) )
return -ENOMEM;
- memset( cl, 0, sizeof(struct i2c_client) );
cl->addr = addr;
cl->adapter = adapter;
diff -rubp linux-2.6.19-rc5_orig/drivers/macintosh/windfarm_lm75_sensor.c linux-2.6.19-rc5_kzalloc/drivers/macintosh/windfarm_lm75_sensor.c
--- linux-2.6.19-rc5_orig/drivers/macintosh/windfarm_lm75_sensor.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/macintosh/windfarm_lm75_sensor.c 2006-11-11 22:44:04.000000000 +0200
@@ -117,10 +117,9 @@ static struct wf_lm75_sensor *wf_lm75_cr
DBG("wf_lm75: creating %s device at address 0x%02x\n",
ds1775 ? "ds1775" : "lm75", addr);
- lm = kmalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL);
+ lm = kzalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL);
if (lm == NULL)
return NULL;
- memset(lm, 0, sizeof(struct wf_lm75_sensor));
/* Usual rant about sensor names not beeing very consistent in
* the device-tree, oh well ...
diff -rubp linux-2.6.19-rc5_orig/drivers/md/dm-emc.c linux-2.6.19-rc5_kzalloc/drivers/md/dm-emc.c
--- linux-2.6.19-rc5_orig/drivers/md/dm-emc.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/md/dm-emc.c 2006-11-11 22:44:04.000000000 +0200
@@ -224,12 +224,10 @@ fail_path:
static struct emc_handler *alloc_emc_handler(void)
{
- struct emc_handler *h = kmalloc(sizeof(*h), GFP_KERNEL);
+ struct emc_handler *h = kzalloc(sizeof(*h), GFP_KERNEL);
- if (h) {
- memset(h, 0, sizeof(*h));
+ if (h)
spin_lock_init(&h->lock);
- }
return h;
}
diff -rubp linux-2.6.19-rc5_orig/drivers/md/dm-hw-handler.c linux-2.6.19-rc5_kzalloc/drivers/md/dm-hw-handler.c
--- linux-2.6.19-rc5_orig/drivers/md/dm-hw-handler.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/md/dm-hw-handler.c 2006-11-11 22:44:04.000000000 +0200
@@ -91,12 +91,10 @@ void dm_put_hw_handler(struct hw_handler
static struct hwh_internal *_alloc_hw_handler(struct hw_handler_type *hwht)
{
- struct hwh_internal *hwhi = kmalloc(sizeof(*hwhi), GFP_KERNEL);
+ struct hwh_internal *hwhi = kzalloc(sizeof(*hwhi), GFP_KERNEL);
- if (hwhi) {
- memset(hwhi, 0, sizeof(*hwhi));
+ if (hwhi)
hwhi->hwht = *hwht;
- }
return hwhi;
}
diff -rubp linux-2.6.19-rc5_orig/drivers/md/dm-path-selector.c linux-2.6.19-rc5_kzalloc/drivers/md/dm-path-selector.c
--- linux-2.6.19-rc5_orig/drivers/md/dm-path-selector.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/md/dm-path-selector.c 2006-11-11 22:44:04.000000000 +0200
@@ -94,12 +94,10 @@ out:
static struct ps_internal *_alloc_path_selector(struct path_selector_type *pst)
{
- struct ps_internal *psi = kmalloc(sizeof(*psi), GFP_KERNEL);
+ struct ps_internal *psi = kzalloc(sizeof(*psi), GFP_KERNEL);
- if (psi) {
- memset(psi, 0, sizeof(*psi));
+ if (psi)
psi->pst = *pst;
- }
return psi;
}
diff -rubp linux-2.6.19-rc5_orig/drivers/md/dm-raid1.c linux-2.6.19-rc5_kzalloc/drivers/md/dm-raid1.c
--- linux-2.6.19-rc5_orig/drivers/md/dm-raid1.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/md/dm-raid1.c 2006-11-11 22:44:04.000000000 +0200
@@ -894,13 +894,12 @@ static struct mirror_set *alloc_context(
len = sizeof(*ms) + (sizeof(ms->mirror[0]) * nr_mirrors);
- ms = kmalloc(len, GFP_KERNEL);
+ ms = kzalloc(len, GFP_KERNEL);
if (!ms) {
ti->error = "Cannot allocate mirror context";
return NULL;
}
- memset(ms, 0, len);
spin_lock_init(&ms->lock);
ms->ti = ti;
diff -rubp linux-2.6.19-rc5_orig/drivers/md/dm-table.c linux-2.6.19-rc5_kzalloc/drivers/md/dm-table.c
--- linux-2.6.19-rc5_orig/drivers/md/dm-table.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/md/dm-table.c 2006-11-11 22:44:04.000000000 +0200
@@ -213,12 +213,11 @@ static int alloc_targets(struct dm_table
int dm_table_create(struct dm_table **result, int mode,
unsigned num_targets, struct mapped_device *md)
{
- struct dm_table *t = kmalloc(sizeof(*t), GFP_KERNEL);
+ struct dm_table *t = kzalloc(sizeof(*t), GFP_KERNEL);
if (!t)
return -ENOMEM;
- memset(t, 0, sizeof(*t));
INIT_LIST_HEAD(&t->devices);
atomic_set(&t->holders, 1);
diff -rubp linux-2.6.19-rc5_orig/drivers/md/dm-target.c linux-2.6.19-rc5_kzalloc/drivers/md/dm-target.c
--- linux-2.6.19-rc5_orig/drivers/md/dm-target.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/md/dm-target.c 2006-11-11 22:44:04.000000000 +0200
@@ -88,12 +88,10 @@ void dm_put_target_type(struct target_ty
static struct tt_internal *alloc_target(struct target_type *t)
{
- struct tt_internal *ti = kmalloc(sizeof(*ti), GFP_KERNEL);
+ struct tt_internal *ti = kzalloc(sizeof(*ti), GFP_KERNEL);
- if (ti) {
- memset(ti, 0, sizeof(*ti));
+ if (ti)
ti->tt = *t;
- }
return ti;
}
diff -rubp linux-2.6.19-rc5_orig/drivers/message/fusion/mptctl.c linux-2.6.19-rc5_kzalloc/drivers/message/fusion/mptctl.c
--- linux-2.6.19-rc5_orig/drivers/message/fusion/mptctl.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/message/fusion/mptctl.c 2006-11-11 22:44:04.000000000 +0200
@@ -962,10 +962,9 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, i
* structures for the SG elements.
*/
i = MAX_SGL_BYTES / 8;
- buflist = kmalloc(i, GFP_USER);
+ buflist = kzalloc(i, GFP_USER);
if (buflist == NULL)
return NULL;
- memset(buflist, 0, i);
buflist_ent = 0;
/* Allocate a single block of memory to store the sg elements and
@@ -1377,13 +1376,12 @@ mptctl_gettargetinfo (unsigned long arg)
* 15- 8: Bus Number
* 7- 0: Target ID
*/
- pmem = kmalloc(numBytes, GFP_KERNEL);
+ pmem = kzalloc(numBytes, GFP_KERNEL);
if (pmem == NULL) {
printk(KERN_ERR "%s::mptctl_gettargetinfo() @%d - no memory available!\n",
__FILE__, __LINE__);
return -ENOMEM;
}
- memset(pmem, 0, numBytes);
pdata = (int *) pmem;
/* Get number of devices
@@ -1617,12 +1615,11 @@ mptctl_eventenable (unsigned long arg)
/* Have not yet allocated memory - do so now.
*/
int sz = MPTCTL_EVENT_LOG_SIZE * sizeof(MPT_IOCTL_EVENTS);
- ioc->events = kmalloc(sz, GFP_KERNEL);
+ ioc->events = kzalloc(sz, GFP_KERNEL);
if (ioc->events == NULL) {
printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n");
return -ENOMEM;
}
- memset(ioc->events, 0, sz);
ioc->alloc_total += sz;
ioc->eventContext = 0;
@@ -2888,13 +2885,12 @@ mptctl_probe(struct pci_dev *pdev, const
* Allocate and inite a MPT_IOCTL structure
*/
sz = sizeof (MPT_IOCTL);
- mem = kmalloc(sz, GFP_KERNEL);
+ mem = kzalloc(sz, GFP_KERNEL);
if (mem == NULL) {
err = -ENOMEM;
goto out_fail;
}
- memset(mem, 0, sz);
ioc->ioctl = (MPT_IOCTL *) mem;
ioc->ioctl->ioc = ioc;
mutex_init(&ioc->ioctl->ioctl_mutex);
diff -rubp linux-2.6.19-rc5_orig/drivers/mfd/mcp-core.c linux-2.6.19-rc5_kzalloc/drivers/mfd/mcp-core.c
--- linux-2.6.19-rc5_orig/drivers/mfd/mcp-core.c 2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/mfd/mcp-core.c 2006-11-11 22:44:04.000000000 +0200
@@ -200,9 +200,8 @@ struct mcp *mcp_host_alloc(struct device
{
struct mcp *mcp;
- mcp = kmalloc(sizeof(struct mcp) + size, GFP_KERNEL);
+ mcp = kzalloc(sizeof(struct mcp) + size, GFP_KERNEL);
if (mcp) {
- memset(mcp, 0, sizeof(struct mcp) + size);
spin_lock_init(&mcp->lock);
mcp->attached_device.parent = parent;
mcp->attached_device.bus = &mcp_bus_type;
diff -rubp linux-2.6.19-rc5_orig/drivers/mfd/ucb1x00-core.c linux-2.6.19-rc5_kzalloc/drivers/mfd/ucb1x00-core.c
--- linux-2.6.19-rc5_orig/drivers/mfd/ucb1x00-core.c 2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/mfd/ucb1x00-core.c 2006-11-11 22:44:04.000000000 +0200
@@ -484,13 +484,11 @@ static int ucb1x00_probe(struct mcp *mcp
goto err_disable;
}
- ucb = kmalloc(sizeof(struct ucb1x00), GFP_KERNEL);
+ ucb = kzalloc(sizeof(struct ucb1x00), GFP_KERNEL);
ret = -ENOMEM;
if (!ucb)
goto err_disable;
- memset(ucb, 0, sizeof(struct ucb1x00));
-
ucb->cdev.class = &ucb1x00_class;
ucb->cdev.dev = &mcp->attached_device;
strlcpy(ucb->cdev.class_id, "ucb1x00", sizeof(ucb->cdev.class_id));
diff -rubp linux-2.6.19-rc5_orig/drivers/misc/ibmasm/command.c linux-2.6.19-rc5_kzalloc/drivers/misc/ibmasm/command.c
--- linux-2.6.19-rc5_orig/drivers/misc/ibmasm/command.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/misc/ibmasm/command.c 2006-11-11 22:44:04.000000000 +0200
@@ -41,18 +41,15 @@ struct command *ibmasm_new_command(struc
if (buffer_size > IBMASM_CMD_MAX_BUFFER_SIZE)
return NULL;
- cmd = kmalloc(sizeof(struct command), GFP_KERNEL);
+ cmd = kzalloc(sizeof(struct command), GFP_KERNEL);
if (cmd == NULL)
return NULL;
- memset(cmd, 0, sizeof(*cmd));
-
- cmd->buffer = kmalloc(buffer_size, GFP_KERNEL);
+ cmd->buffer = kzalloc(buffer_size, GFP_KERNEL);
if (cmd->buffer == NULL) {
kfree(cmd);
return NULL;
}
- memset(cmd->buffer, 0, buffer_size);
cmd->buffer_size = buffer_size;
kobject_init(&cmd->kobj);
diff -rubp linux-2.6.19-rc5_orig/drivers/misc/ibmasm/ibmasmfs.c linux-2.6.19-rc5_kzalloc/drivers/misc/ibmasm/ibmasmfs.c
--- linux-2.6.19-rc5_orig/drivers/misc/ibmasm/ibmasmfs.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/misc/ibmasm/ibmasmfs.c 2006-11-11 22:44:04.000000000 +0200
@@ -563,12 +563,10 @@ static ssize_t remote_settings_file_writ
if (*offset != 0)
return 0;
- buff = kmalloc (count + 1, GFP_KERNEL);
+ buff = kzalloc (count + 1, GFP_KERNEL);
if (!buff)
return -ENOMEM;
- memset(buff, 0x0, count + 1);
-
if (copy_from_user(buff, ubuff, count)) {
kfree(buff);
return -EFAULT;
diff -rubp linux-2.6.19-rc5_orig/drivers/misc/ibmasm/module.c linux-2.6.19-rc5_kzalloc/drivers/misc/ibmasm/module.c
--- linux-2.6.19-rc5_orig/drivers/misc/ibmasm/module.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/misc/ibmasm/module.c 2006-11-11 22:44:04.000000000 +0200
@@ -77,13 +77,12 @@ static int __devinit ibmasm_init_one(str
/* vnc client won't work without bus-mastering */
pci_set_master(pdev);
- sp = kmalloc(sizeof(struct service_processor), GFP_KERNEL);
+ sp = kzalloc(sizeof(struct service_processor), GFP_KERNEL);
if (sp == NULL) {
dev_err(&pdev->dev, "Failed to allocate memory\n");
result = -ENOMEM;
goto error_kmalloc;
}
- memset(sp, 0, sizeof(struct service_processor));
spin_lock_init(&sp->lock);
INIT_LIST_HEAD(&sp->command_queue);
diff -rubp linux-2.6.19-rc5_orig/drivers/mmc/mmc_block.c linux-2.6.19-rc5_kzalloc/drivers/mmc/mmc_block.c
--- linux-2.6.19-rc5_orig/drivers/mmc/mmc_block.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/mmc/mmc_block.c 2006-11-11 22:44:04.000000000 +0200
@@ -414,14 +414,12 @@ static struct mmc_blk_data *mmc_blk_allo
return ERR_PTR(-ENOSPC);
__set_bit(devidx, dev_use);
- md = kmalloc(sizeof(struct mmc_blk_data), GFP_KERNEL);
+ md = kzalloc(sizeof(struct mmc_blk_data), GFP_KERNEL);
if (!md) {
ret = -ENOMEM;
goto out;
}
- memset(md, 0, sizeof(struct mmc_blk_data));
-
/*
* Set the read-only status based on the supported commands
* and the write protect switch.
diff -rubp linux-2.6.19-rc5_orig/drivers/mmc/mmc_sysfs.c linux-2.6.19-rc5_kzalloc/drivers/mmc/mmc_sysfs.c
--- linux-2.6.19-rc5_orig/drivers/mmc/mmc_sysfs.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/mmc/mmc_sysfs.c 2006-11-11 22:44:04.000000000 +0200
@@ -263,10 +263,8 @@ struct mmc_host *mmc_alloc_host_sysfs(in
{
struct mmc_host *host;
- host = kmalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL);
+ host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL);
if (host) {
- memset(host, 0, sizeof(struct mmc_host) + extra);
-
host->dev = dev;
host->class_dev.dev = host->dev;
host->class_dev.class = &mmc_host_class;
diff -rubp linux-2.6.19-rc5_orig/drivers/nubus/nubus.c linux-2.6.19-rc5_kzalloc/drivers/nubus/nubus.c
--- linux-2.6.19-rc5_orig/drivers/nubus/nubus.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/nubus/nubus.c 2006-11-11 22:44:04.000000000 +0200
@@ -466,9 +466,8 @@ static struct nubus_dev* __init
parent->base, dir.base);
/* Actually we should probably panic if this fails */
- if ((dev = kmalloc(sizeof(*dev), GFP_ATOMIC)) == NULL)
+ if ((dev = kzalloc(sizeof(*dev), GFP_ATOMIC)) == NULL)
return NULL;
- memset(dev, 0, sizeof(*dev));
dev->resid = parent->type;
dev->directory = dir.base;
dev->board = board;
@@ -800,9 +799,8 @@ static struct nubus_board* __init nubus_
nubus_rewind(&rp, FORMAT_BLOCK_SIZE, bytelanes);
/* Actually we should probably panic if this fails */
- if ((board = kmalloc(sizeof(*board), GFP_ATOMIC)) == NULL)
+ if ((board = kzalloc(sizeof(*board), GFP_ATOMIC)) == NULL)
return NULL;
- memset(board, 0, sizeof(*board));
board->fblock = rp;
/* Dump the format block for debugging purposes */
diff -rubp linux-2.6.19-rc5_orig/drivers/parport/parport_cs.c linux-2.6.19-rc5_kzalloc/drivers/parport/parport_cs.c
--- linux-2.6.19-rc5_orig/drivers/parport/parport_cs.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/parport/parport_cs.c 2006-11-11 22:44:04.000000000 +0200
@@ -106,9 +106,8 @@ static int parport_probe(struct pcmcia_d
DEBUG(0, "parport_attach()\n");
/* Create new parport device */
- info = kmalloc(sizeof(*info), GFP_KERNEL);
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) return -ENOMEM;
- memset(info, 0, sizeof(*info));
link->priv = info;
info->p_dev = link;
diff -rubp linux-2.6.19-rc5_orig/drivers/parport/parport_serial.c linux-2.6.19-rc5_kzalloc/drivers/parport/parport_serial.c
--- linux-2.6.19-rc5_orig/drivers/parport/parport_serial.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/parport/parport_serial.c 2006-11-11 22:44:04.000000000 +0200
@@ -324,10 +324,9 @@ static int __devinit parport_serial_pci_
struct parport_serial_private *priv;
int err;
- priv = kmalloc (sizeof *priv, GFP_KERNEL);
+ priv = kzalloc (sizeof *priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
- memset(priv, 0, sizeof(struct parport_serial_private));
pci_set_drvdata (dev, priv);
err = pci_enable_device (dev);
diff -rubp linux-2.6.19-rc5_orig/drivers/parport/share.c linux-2.6.19-rc5_kzalloc/drivers/parport/share.c
--- linux-2.6.19-rc5_orig/drivers/parport/share.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/parport/share.c 2006-11-11 22:44:04.000000000 +0200
@@ -282,14 +282,13 @@ struct parport *parport_register_port(un
int device;
char *name;
- tmp = kmalloc(sizeof(struct parport), GFP_KERNEL);
+ tmp = kzalloc(sizeof(struct parport), GFP_KERNEL);
if (!tmp) {
printk(KERN_WARNING "parport: memory squeeze\n");
return NULL;
}
/* Init our structure */
- memset(tmp, 0, sizeof(struct parport));
tmp->base = base;
tmp->irq = irq;
tmp->dma = dma;
diff -rubp linux-2.6.19-rc5_orig/drivers/pci/hotplug/cpqphp_ctrl.c linux-2.6.19-rc5_kzalloc/drivers/pci/hotplug/cpqphp_ctrl.c
--- linux-2.6.19-rc5_orig/drivers/pci/hotplug/cpqphp_ctrl.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/pci/hotplug/cpqphp_ctrl.c 2006-11-11 22:44:18.000000000 +0200
@@ -973,7 +973,7 @@ struct pci_func *cpqhp_slot_create(u8 bu
struct pci_func *new_slot;
struct pci_func *next;
- new_slot = kmalloc(sizeof(*new_slot), GFP_KERNEL);
+ new_slot = kzalloc(sizeof(*new_slot), GFP_KERNEL);
if (new_slot == NULL) {
/* I'm not dead yet!
@@ -981,8 +981,6 @@ struct pci_func *cpqhp_slot_create(u8 bu
return new_slot;
}
- memset(new_slot, 0, sizeof(struct pci_func));
-
new_slot->next = NULL;
new_slot->configured = 1;
diff -rubp linux-2.6.19-rc5_orig/drivers/pci/hotplug/pciehp_hpc.c linux-2.6.19-rc5_kzalloc/drivers/pci/hotplug/pciehp_hpc.c
--- linux-2.6.19-rc5_orig/drivers/pci/hotplug/pciehp_hpc.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/pci/hotplug/pciehp_hpc.c 2006-11-11 22:44:04.000000000 +0200
@@ -1322,15 +1322,13 @@ int pcie_init(struct controller * ctrl,
DBG_ENTER_ROUTINE
spin_lock_init(&list_lock);
- php_ctlr = (struct php_ctlr_state_s *) kmalloc(sizeof(struct php_ctlr_state_s), GFP_KERNEL);
+ php_ctlr = (struct php_ctlr_state_s *) kzalloc(sizeof(struct php_ctlr_state_s), GFP_KERNEL);
if (!php_ctlr) { /* allocate controller state data */
err("%s: HPC controller memory allocation error!\n", __FUNCTION__);
goto abort;
}
- memset(php_ctlr, 0, sizeof(struct php_ctlr_state_s));
-
pdev = dev->port;
php_ctlr->pci_dev = pdev; /* save pci_dev in context */
diff -rubp linux-2.6.19-rc5_orig/drivers/pci/pcie/aer/aerdrv.c linux-2.6.19-rc5_kzalloc/drivers/pci/pcie/aer/aerdrv.c
--- linux-2.6.19-rc5_orig/drivers/pci/pcie/aer/aerdrv.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/pci/pcie/aer/aerdrv.c 2006-11-11 22:44:04.000000000 +0200
@@ -148,11 +148,10 @@ static struct aer_rpc* aer_alloc_rpc(str
{
struct aer_rpc *rpc;
- if (!(rpc = (struct aer_rpc *)kmalloc(sizeof(struct aer_rpc),
+ if (!(rpc = (struct aer_rpc *)kzalloc(sizeof(struct aer_rpc),
GFP_KERNEL)))
return NULL;
- memset(rpc, 0, sizeof(struct aer_rpc));
/*
* Initialize Root lock access, e_lock, to Root Error Status Reg,
* Root Error ID Reg, and Root error producer/consumer index.
diff -rubp linux-2.6.19-rc5_orig/drivers/pnp/core.c linux-2.6.19-rc5_kzalloc/drivers/pnp/core.c
--- linux-2.6.19-rc5_orig/drivers/pnp/core.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/pnp/core.c 2006-11-11 22:44:04.000000000 +0200
@@ -26,12 +26,9 @@ void *pnp_alloc(long size)
{
void *result;
- result = kmalloc(size, GFP_KERNEL);
- if (!result){
+ result = kzalloc(size, GFP_KERNEL);
+ if (!result)
printk(KERN_ERR "pnp: Out of Memory\n");
- return NULL;
- }
- memset(result, 0, size);
return result;
}
diff -rubp linux-2.6.19-rc5_orig/drivers/rapidio/rio-scan.c linux-2.6.19-rc5_kzalloc/drivers/rapidio/rio-scan.c
--- linux-2.6.19-rc5_orig/drivers/rapidio/rio-scan.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/rapidio/rio-scan.c 2006-11-11 22:44:04.000000000 +0200
@@ -297,11 +297,10 @@ static struct rio_dev *rio_setup_device(
struct rio_switch *rswitch;
int result, rdid;
- rdev = kmalloc(sizeof(struct rio_dev), GFP_KERNEL);
+ rdev = kzalloc(sizeof(struct rio_dev), GFP_KERNEL);
if (!rdev)
goto out;
- memset(rdev, 0, sizeof(struct rio_dev));
rdev->net = net;
rio_mport_read_config_32(port, destid, hopcount, RIO_DEV_ID_CAR,
&result);
@@ -784,9 +783,8 @@ static struct rio_net __devinit *rio_all
{
struct rio_net *net;
- net = kmalloc(sizeof(struct rio_net), GFP_KERNEL);
+ net = kzalloc(sizeof(struct rio_net), GFP_KERNEL);
if (net) {
- memset(net, 0, sizeof(struct rio_net));
INIT_LIST_HEAD(&net->node);
INIT_LIST_HEAD(&net->devices);
INIT_LIST_HEAD(&net->mports);
diff -rubp linux-2.6.19-rc5_orig/drivers/sbus/char/bbc_envctrl.c linux-2.6.19-rc5_kzalloc/drivers/sbus/char/bbc_envctrl.c
--- linux-2.6.19-rc5_orig/drivers/sbus/char/bbc_envctrl.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/sbus/char/bbc_envctrl.c 2006-11-11 22:44:04.000000000 +0200
@@ -480,11 +480,10 @@ static int kenvctrld(void *__unused)
static void attach_one_temp(struct linux_ebus_child *echild, int temp_idx)
{
- struct bbc_cpu_temperature *tp = kmalloc(sizeof(*tp), GFP_KERNEL);
+ struct bbc_cpu_temperature *tp = kzalloc(sizeof(*tp), GFP_KERNEL);
if (!tp)
return;
- memset(tp, 0, sizeof(*tp));
tp->client = bbc_i2c_attach(echild);
if (!tp->client) {
kfree(tp);
@@ -526,11 +525,10 @@ static void attach_one_temp(struct linux
static void attach_one_fan(struct linux_ebus_child *echild, int fan_idx)
{
- struct bbc_fan_control *fp = kmalloc(sizeof(*fp), GFP_KERNEL);
+ struct bbc_fan_control *fp = kzalloc(sizeof(*fp), GFP_KERNEL);
if (!fp)
return;
- memset(fp, 0, sizeof(*fp));
fp->client = bbc_i2c_attach(echild);
if (!fp->client) {
kfree(fp);
diff -rubp linux-2.6.19-rc5_orig/drivers/sbus/char/bbc_i2c.c linux-2.6.19-rc5_kzalloc/drivers/sbus/char/bbc_i2c.c
--- linux-2.6.19-rc5_orig/drivers/sbus/char/bbc_i2c.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/sbus/char/bbc_i2c.c 2006-11-11 22:44:04.000000000 +0200
@@ -155,10 +155,9 @@ struct bbc_i2c_client *bbc_i2c_attach(st
if (!bp)
return NULL;
- client = kmalloc(sizeof(*client), GFP_KERNEL);
+ client = kzalloc(sizeof(*client), GFP_KERNEL);
if (!client)
return NULL;
- memset(client, 0, sizeof(*client));
client->bp = bp;
client->echild = echild;
client->bus = echild->resource[0].start;
@@ -356,13 +355,12 @@ static void __init reset_one_i2c(struct
static int __init attach_one_i2c(struct linux_ebus_device *edev, int index)
{
- struct bbc_i2c_bus *bp = kmalloc(sizeof(*bp), GFP_KERNEL);
+ struct bbc_i2c_bus *bp = kzalloc(sizeof(*bp), GFP_KERNEL);
struct linux_ebus_child *echild;
int entry;
if (!bp)
return -ENOMEM;
- memset(bp, 0, sizeof(*bp));
bp->i2c_control_regs = ioremap(edev->resource[0].start, 0x2);
if (!bp->i2c_control_regs)
diff -rubp linux-2.6.19-rc5_orig/drivers/sbus/char/vfc_dev.c linux-2.6.19-rc5_kzalloc/drivers/sbus/char/vfc_dev.c
--- linux-2.6.19-rc5_orig/drivers/sbus/char/vfc_dev.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/sbus/char/vfc_dev.c 2006-11-11 22:44:04.000000000 +0200
@@ -260,11 +260,10 @@ static int vfc_debug(struct vfc_dev *dev
if (copy_from_user(&inout, argp, sizeof(inout)))
return -EFAULT;
- buffer = kmalloc(inout.len, GFP_KERNEL);
+ buffer = kzalloc(inout.len, GFP_KERNEL);
if (buffer == NULL)
return -ENOMEM;
- memset(buffer,0,inout.len);
vfc_lock_device(dev);
inout.ret=
vfc_i2c_recvbuf(dev,inout.addr & 0xff
@@ -659,12 +658,11 @@ static int vfc_probe(void)
if (!cards)
return -ENODEV;
- vfc_dev_lst = (struct vfc_dev **)kmalloc(sizeof(struct vfc_dev *) *
+ vfc_dev_lst = (struct vfc_dev **)kzalloc(sizeof(struct vfc_dev *) *
(cards+1),
GFP_KERNEL);
if (vfc_dev_lst == NULL)
return -ENOMEM;
- memset(vfc_dev_lst, 0, sizeof(struct vfc_dev *) * (cards + 1));
vfc_dev_lst[cards] = NULL;
ret = register_chrdev(VFC_MAJOR, vfcstr, &vfc_fops);
diff -rubp linux-2.6.19-rc5_orig/drivers/sh/superhyway/superhyway.c linux-2.6.19-rc5_kzalloc/drivers/sh/superhyway/superhyway.c
--- linux-2.6.19-rc5_orig/drivers/sh/superhyway/superhyway.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/sh/superhyway/superhyway.c 2006-11-11 22:44:04.000000000 +0200
@@ -56,11 +56,9 @@ int superhyway_add_device(unsigned long
struct superhyway_device *dev = sdev;
if (!dev) {
- dev = kmalloc(sizeof(struct superhyway_device), GFP_KERNEL);
+ dev = kzalloc(sizeof(struct superhyway_device), GFP_KERNEL);
if (!dev)
return -ENOMEM;
-
- memset(dev, 0, sizeof(struct superhyway_device));
}
dev->bus = bus;
diff -rubp linux-2.6.19-rc5_orig/drivers/sn/ioc3.c linux-2.6.19-rc5_kzalloc/drivers/sn/ioc3.c
--- linux-2.6.19-rc5_orig/drivers/sn/ioc3.c 2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/sn/ioc3.c 2006-11-11 22:44:18.000000000 +0200
@@ -629,7 +629,7 @@ static int ioc3_probe(struct pci_dev *pd
#endif
/* Set up per-IOC3 data */
- idd = kmalloc(sizeof(struct ioc3_driver_data), GFP_KERNEL);
+ idd = kzalloc(sizeof(struct ioc3_driver_data), GFP_KERNEL);
if (!idd) {
printk(KERN_WARNING
"%s: Failed to allocate IOC3 data for pci_dev %s.\n",
@@ -637,7 +637,6 @@ static int ioc3_probe(struct pci_dev *pd
ret = -ENODEV;
goto out_idd;
}
- memset(idd, 0, sizeof(struct ioc3_driver_data));
spin_lock_init(&idd->ir_lock);
spin_lock_init(&idd->gpio_lock);
idd->pdev = pdev;
diff -rubp linux-2.6.19-rc5_orig/drivers/telephony/ixj_pcmcia.c linux-2.6.19-rc5_kzalloc/drivers/telephony/ixj_pcmcia.c
--- linux-2.6.19-rc5_orig/drivers/telephony/ixj_pcmcia.c 2006-11-09 12:16:21.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/drivers/telephony/ixj_pcmcia.c 2006-11-11 22:44:04.000000000 +0200
@@ -46,11 +46,10 @@ static int ixj_probe(struct pcmcia_devic
p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
p_dev->io.IOAddrLines = 3;
p_dev->conf.IntType = INT_MEMORY_AND_IO;
- p_dev->priv = kmalloc(sizeof(struct ixj_info_t), GFP_KERNEL);
+ p_dev->priv = kzalloc(sizeof(struct ixj_info_t), GFP_KERNEL);
if (!p_dev->priv) {
return -ENOMEM;
}
- memset(p_dev->priv, 0, sizeof(struct ixj_info_t));
return ixj_config(p_dev);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-11-12 17:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-12 17:27 [PATH] Replace kmalloc+memset with kzalloc 6/17 Burman Yan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®