aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/core/sysfs.c9
-rw-r--r--include/rdma/ib_verbs.h2
2 files changed, 5 insertions, 6 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 107c8ba2046c..f54f107ef668 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -1036,7 +1036,7 @@ static int add_port(struct ib_device *device, int port_num,
1036 p->port_num = port_num; 1036 p->port_num = port_num;
1037 1037
1038 ret = kobject_init_and_add(&p->kobj, &port_type, 1038 ret = kobject_init_and_add(&p->kobj, &port_type,
1039 device->ports_parent, 1039 device->ports_kobj,
1040 "%d", port_num); 1040 "%d", port_num);
1041 if (ret) { 1041 if (ret) {
1042 kfree(p); 1042 kfree(p);
@@ -1305,7 +1305,7 @@ static void free_port_list_attributes(struct ib_device *device)
1305 kobject_put(p); 1305 kobject_put(p);
1306 } 1306 }
1307 1307
1308 kobject_put(device->ports_parent); 1308 kobject_put(device->ports_kobj);
1309} 1309}
1310 1310
1311int ib_device_register_sysfs(struct ib_device *device, 1311int ib_device_register_sysfs(struct ib_device *device,
@@ -1323,9 +1323,8 @@ int ib_device_register_sysfs(struct ib_device *device,
1323 if (ret) 1323 if (ret)
1324 goto err; 1324 goto err;
1325 1325
1326 device->ports_parent = kobject_create_and_add("ports", 1326 device->ports_kobj = kobject_create_and_add("ports", &class_dev->kobj);
1327 &class_dev->kobj); 1327 if (!device->ports_kobj) {
1328 if (!device->ports_parent) {
1329 ret = -ENOMEM; 1328 ret = -ENOMEM;
1330 goto err_put; 1329 goto err_put;
1331 } 1330 }
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 7ce617d77f8f..7d732cf87886 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2542,7 +2542,7 @@ struct ib_device {
2542 /* First group for device attributes, NULL terminated array */ 2542 /* First group for device attributes, NULL terminated array */
2543 const struct attribute_group *groups[2]; 2543 const struct attribute_group *groups[2];
2544 2544
2545 struct kobject *ports_parent; 2545 struct kobject *ports_kobj;
2546 struct list_head port_list; 2546 struct list_head port_list;
2547 2547
2548 enum { 2548 enum {