aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/core/sysfs.c')
-rw-r--r--drivers/infiniband/core/sysfs.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index cbd0383f622e..0b84a9cdfe5b 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -326,6 +326,8 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr,
326 int width = (tab_attr->index >> 16) & 0xff; 326 int width = (tab_attr->index >> 16) & 0xff;
327 struct ib_mad *in_mad = NULL; 327 struct ib_mad *in_mad = NULL;
328 struct ib_mad *out_mad = NULL; 328 struct ib_mad *out_mad = NULL;
329 size_t mad_size = sizeof(*out_mad);
330 u16 out_mad_pkey_index = 0;
329 ssize_t ret; 331 ssize_t ret;
330 332
331 if (!p->ibdev->process_mad) 333 if (!p->ibdev->process_mad)
@@ -347,7 +349,10 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr,
347 in_mad->data[41] = p->port_num; /* PortSelect field */ 349 in_mad->data[41] = p->port_num; /* PortSelect field */
348 350
349 if ((p->ibdev->process_mad(p->ibdev, IB_MAD_IGNORE_MKEY, 351 if ((p->ibdev->process_mad(p->ibdev, IB_MAD_IGNORE_MKEY,
350 p->port_num, NULL, NULL, in_mad, out_mad) & 352 p->port_num, NULL, NULL,
353 (const struct ib_mad_hdr *)in_mad, mad_size,
354 (struct ib_mad_hdr *)out_mad, &mad_size,
355 &out_mad_pkey_index) &
351 (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) != 356 (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) !=
352 (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) { 357 (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) {
353 ret = -EINVAL; 358 ret = -EINVAL;
@@ -456,6 +461,7 @@ static void ib_device_release(struct device *device)
456{ 461{
457 struct ib_device *dev = container_of(device, struct ib_device, dev); 462 struct ib_device *dev = container_of(device, struct ib_device, dev);
458 463
464 kfree(dev->port_immutable);
459 kfree(dev); 465 kfree(dev);
460} 466}
461 467
@@ -864,7 +870,7 @@ int ib_device_register_sysfs(struct ib_device *device,
864 goto err_put; 870 goto err_put;
865 } 871 }
866 872
867 if (device->node_type == RDMA_NODE_IB_SWITCH) { 873 if (rdma_cap_ib_switch(device)) {
868 ret = add_port(device, 0, port_callback); 874 ret = add_port(device, 0, port_callback);
869 if (ret) 875 if (ret)
870 goto err_put; 876 goto err_put;