]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[BONDING]: Replace kmalloc() + memset() pairs with the appropriate kzalloc() calls
authorJoe Jin <lkmaillist@gmail.com>
Tue, 6 Feb 2007 22:16:40 +0000 (14:16 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 8 Feb 2007 20:38:59 +0000 (12:38 -0800)
Replace kmalloc() + memset() pairs with the appropriate kzalloc() calls in
the bonding driver.

Signed-off-by: Joe Jin <lkmaillist@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/net/bonding/bond_alb.c
drivers/net/bonding/bond_main.c

index 32923162179ef8b45948149972343744144694ec..217a2eedee0aafc143e5533aff617b70693927cb 100644 (file)
@@ -184,7 +184,7 @@ static int tlb_initialize(struct bonding *bond)
 
        spin_lock_init(&(bond_info->tx_hashtbl_lock));
 
-       new_hashtbl = kmalloc(size, GFP_KERNEL);
+       new_hashtbl = kzalloc(size, GFP_KERNEL);
        if (!new_hashtbl) {
                printk(KERN_ERR DRV_NAME
                       ": %s: Error: Failed to allocate TLB hash table\n",
@@ -195,8 +195,6 @@ static int tlb_initialize(struct bonding *bond)
 
        bond_info->tx_hashtbl = new_hashtbl;
 
-       memset(bond_info->tx_hashtbl, 0, size);
-
        for (i = 0; i < TLB_HASH_TABLE_SIZE; i++) {
                tlb_init_table_entry(&bond_info->tx_hashtbl[i], 1);
        }
index d3801a00d3d5152f6009024bb41248db950dc43f..8ce8fec615bad67d99a7e6ad9e288cd5fe5ec5dc 100644 (file)
@@ -1343,14 +1343,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
                        "inaccurate.\n", bond_dev->name, slave_dev->name);
        }
 
-       new_slave = kmalloc(sizeof(struct slave), GFP_KERNEL);
+       new_slave = kzalloc(sizeof(struct slave), GFP_KERNEL);
        if (!new_slave) {
                res = -ENOMEM;
                goto err_undo_flags;
        }
 
-       memset(new_slave, 0, sizeof(struct slave));
-
        /* save slave's original flags before calling
         * netdev_set_master and dev_open
         */