Commit 243cb4e5 authored by Joe Jin's avatar Joe Jin Committed by David S. Miller

[BONDING]: Replace kmalloc() + memset() pairs with the appropriate kzalloc() calls

Replace kmalloc() + memset() pairs with the appropriate kzalloc() calls in
the bonding driver.
Signed-off-by: default avatarJoe Jin <lkmaillist@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 6b31a515
...@@ -184,7 +184,7 @@ static int tlb_initialize(struct bonding *bond) ...@@ -184,7 +184,7 @@ static int tlb_initialize(struct bonding *bond)
spin_lock_init(&(bond_info->tx_hashtbl_lock)); spin_lock_init(&(bond_info->tx_hashtbl_lock));
new_hashtbl = kmalloc(size, GFP_KERNEL); new_hashtbl = kzalloc(size, GFP_KERNEL);
if (!new_hashtbl) { if (!new_hashtbl) {
printk(KERN_ERR DRV_NAME printk(KERN_ERR DRV_NAME
": %s: Error: Failed to allocate TLB hash table\n", ": %s: Error: Failed to allocate TLB hash table\n",
...@@ -195,8 +195,6 @@ static int tlb_initialize(struct bonding *bond) ...@@ -195,8 +195,6 @@ static int tlb_initialize(struct bonding *bond)
bond_info->tx_hashtbl = new_hashtbl; bond_info->tx_hashtbl = new_hashtbl;
memset(bond_info->tx_hashtbl, 0, size);
for (i = 0; i < TLB_HASH_TABLE_SIZE; i++) { for (i = 0; i < TLB_HASH_TABLE_SIZE; i++) {
tlb_init_table_entry(&bond_info->tx_hashtbl[i], 1); tlb_init_table_entry(&bond_info->tx_hashtbl[i], 1);
} }
......
...@@ -1343,14 +1343,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) ...@@ -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); "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) { if (!new_slave) {
res = -ENOMEM; res = -ENOMEM;
goto err_undo_flags; goto err_undo_flags;
} }
memset(new_slave, 0, sizeof(struct slave));
/* save slave's original flags before calling /* save slave's original flags before calling
* netdev_set_master and dev_open * netdev_set_master and dev_open
*/ */
......
Markdown is supported
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