aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2005-11-02 10:23:14 -0500
committerRoland Dreier <rolandd@cisco.com>2005-11-02 10:23:14 -0500
commitde6eb66b56d9df5ce6bd254994f05e065214e8cd (patch)
tree7463446a05b5e9a5d2fc400da0be8d4a6c2ff6f1 /drivers/infiniband/hw/mthca
parent7b28b0d000eeb62d77add636f5d6eb0da04e48aa (diff)
[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>
Diffstat (limited to 'drivers/infiniband/hw/mthca')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mr.c4
-rw-r--r--drivers/infiniband/hw/mthca/mthca_profile.c4
2 files changed, 2 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
index 1f97a44477f5..e995e2aa016d 100644
--- a/drivers/infiniband/hw/mthca/mthca_mr.c
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c
@@ -140,13 +140,11 @@ static int __devinit mthca_buddy_init(struct mthca_buddy *buddy, int max_order)
140 buddy->max_order = max_order; 140 buddy->max_order = max_order;
141 spin_lock_init(&buddy->lock); 141 spin_lock_init(&buddy->lock);
142 142
143 buddy->bits = kmalloc((buddy->max_order + 1) * sizeof (long *), 143 buddy->bits = kzalloc((buddy->max_order + 1) * sizeof (long *),
144 GFP_KERNEL); 144 GFP_KERNEL);
145 if (!buddy->bits) 145 if (!buddy->bits)
146 goto err_out; 146 goto err_out;
147 147
148 memset(buddy->bits, 0, (buddy->max_order + 1) * sizeof (long *));
149
150 for (i = 0; i <= buddy->max_order; ++i) { 148 for (i = 0; i <= buddy->max_order; ++i) {
151 s = BITS_TO_LONGS(1 << (buddy->max_order - i)); 149 s = BITS_TO_LONGS(1 << (buddy->max_order - i));
152 buddy->bits[i] = kmalloc(s * sizeof (long), GFP_KERNEL); 150 buddy->bits[i] = kmalloc(s * sizeof (long), GFP_KERNEL);
diff --git a/drivers/infiniband/hw/mthca/mthca_profile.c b/drivers/infiniband/hw/mthca/mthca_profile.c
index 0576056b34f4..408cd551bff1 100644
--- a/drivers/infiniband/hw/mthca/mthca_profile.c
+++ b/drivers/infiniband/hw/mthca/mthca_profile.c
@@ -80,12 +80,10 @@ u64 mthca_make_profile(struct mthca_dev *dev,
80 struct mthca_resource tmp; 80 struct mthca_resource tmp;
81 int i, j; 81 int i, j;
82 82
83 profile = kmalloc(MTHCA_RES_NUM * sizeof *profile, GFP_KERNEL); 83 profile = kzalloc(MTHCA_RES_NUM * sizeof *profile, GFP_KERNEL);
84 if (!profile) 84 if (!profile)
85 return -ENOMEM; 85 return -ENOMEM;
86 86
87 memset(profile, 0, MTHCA_RES_NUM * sizeof *profile);
88
89 profile[MTHCA_RES_QP].size = dev_lim->qpc_entry_sz; 87 profile[MTHCA_RES_QP].size = dev_lim->qpc_entry_sz;
90 profile[MTHCA_RES_EEC].size = dev_lim->eec_entry_sz; 88 profile[MTHCA_RES_EEC].size = dev_lim->eec_entry_sz;
91 profile[MTHCA_RES_SRQ].size = dev_lim->srq_entry_sz; 89 profile[MTHCA_RES_SRQ].size = dev_lim->srq_entry_sz;