aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 30b67c200267..0ae27fa26c7a 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -55,7 +55,7 @@ static int mthca_query_device(struct ib_device *ibdev,
55 55
56 u8 status; 56 u8 status;
57 57
58 in_mad = kmalloc(sizeof *in_mad, GFP_KERNEL); 58 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
59 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); 59 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
60 if (!in_mad || !out_mad) 60 if (!in_mad || !out_mad)
61 goto out; 61 goto out;
@@ -64,7 +64,6 @@ static int mthca_query_device(struct ib_device *ibdev,
64 64
65 props->fw_ver = mdev->fw_ver; 65 props->fw_ver = mdev->fw_ver;
66 66
67 memset(in_mad, 0, sizeof *in_mad);
68 in_mad->base_version = 1; 67 in_mad->base_version = 1;
69 in_mad->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED; 68 in_mad->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED;
70 in_mad->class_version = 1; 69 in_mad->class_version = 1;
@@ -128,14 +127,13 @@ static int mthca_query_port(struct ib_device *ibdev,
128 int err = -ENOMEM; 127 int err = -ENOMEM;
129 u8 status; 128 u8 status;
130 129
131 in_mad = kmalloc(sizeof *in_mad, GFP_KERNEL); 130 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
132 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); 131 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
133 if (!in_mad || !out_mad) 132 if (!in_mad || !out_mad)
134 goto out; 133 goto out;
135 134
136 memset(props, 0, sizeof *props); 135 memset(props, 0, sizeof *props);
137 136
138 memset(in_mad, 0, sizeof *in_mad);
139 in_mad->base_version = 1; 137 in_mad->base_version = 1;
140 in_mad->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED; 138 in_mad->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED;
141 in_mad->class_version = 1; 139 in_mad->class_version = 1;
@@ -220,12 +218,11 @@ static int mthca_query_pkey(struct ib_device *ibdev,
220 int err = -ENOMEM; 218 int err = -ENOMEM;
221 u8 status; 219 u8 status;
222 220
223 in_mad = kmalloc(sizeof *in_mad, GFP_KERNEL); 221 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
224 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); 222 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
225 if (!in_mad || !out_mad) 223 if (!in_mad || !out_mad)
226 goto out; 224 goto out;
227 225
228 memset(in_mad, 0, sizeof *in_mad);
229 in_mad->base_version = 1; 226 in_mad->base_version = 1;
230 in_mad->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED; 227 in_mad->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED;
231 in_mad->class_version = 1; 228 in_mad->class_version = 1;
@@ -259,12 +256,11 @@ static int mthca_query_gid(struct ib_device *ibdev, u8 port,
259 int err = -ENOMEM; 256 int err = -ENOMEM;
260 u8 status; 257 u8 status;
261 258
262 in_mad = kmalloc(sizeof *in_mad, GFP_KERNEL); 259 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
263 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); 260 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
264 if (!in_mad || !out_mad) 261 if (!in_mad || !out_mad)
265 goto out; 262 goto out;
266 263
267 memset(in_mad, 0, sizeof *in_mad);
268 in_mad->base_version = 1; 264 in_mad->base_version = 1;
269 in_mad->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED; 265 in_mad->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED;
270 in_mad->class_version = 1; 266 in_mad->class_version = 1;