[IB] kzalloc() conversions
Replace kmalloc()+memset(,0,) with kzalloc(), for a net savings of 35 source lines and about 500 bytes of text. Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
@@ -140,13 +140,11 @@ static int __devinit mthca_buddy_init(struct mthca_buddy *buddy, int max_order)
|
||||
buddy->max_order = max_order;
|
||||
spin_lock_init(&buddy->lock);
|
||||
|
||||
buddy->bits = kmalloc((buddy->max_order + 1) * sizeof (long *),
|
||||
buddy->bits = kzalloc((buddy->max_order + 1) * sizeof (long *),
|
||||
GFP_KERNEL);
|
||||
if (!buddy->bits)
|
||||
goto err_out;
|
||||
|
||||
memset(buddy->bits, 0, (buddy->max_order + 1) * sizeof (long *));
|
||||
|
||||
for (i = 0; i <= buddy->max_order; ++i) {
|
||||
s = BITS_TO_LONGS(1 << (buddy->max_order - i));
|
||||
buddy->bits[i] = kmalloc(s * sizeof (long), GFP_KERNEL);
|
||||
|
@@ -80,12 +80,10 @@ u64 mthca_make_profile(struct mthca_dev *dev,
|
||||
struct mthca_resource tmp;
|
||||
int i, j;
|
||||
|
||||
profile = kmalloc(MTHCA_RES_NUM * sizeof *profile, GFP_KERNEL);
|
||||
profile = kzalloc(MTHCA_RES_NUM * sizeof *profile, GFP_KERNEL);
|
||||
if (!profile)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(profile, 0, MTHCA_RES_NUM * sizeof *profile);
|
||||
|
||||
profile[MTHCA_RES_QP].size = dev_lim->qpc_entry_sz;
|
||||
profile[MTHCA_RES_EEC].size = dev_lim->eec_entry_sz;
|
||||
profile[MTHCA_RES_SRQ].size = dev_lim->srq_entry_sz;
|
||||
|
Reference in New Issue
Block a user