From: Junxian Huang huangjunxian6@hisilicon.com
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IAL7SX
----------------------------------------------------------------------
The sysfs should be created only after all necessary resources are inited.
Fixes: 523f34d81ea7 ("RDMA/hns: Support congestion control algorithm parameter configuration") Signed-off-by: Junxian Huang huangjunxian6@hisilicon.com Signed-off-by: Xinghai Cen cenxinghai@h-partners.com --- drivers/infiniband/hw/hns/hns_roce_sysfs.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_sysfs.c b/drivers/infiniband/hw/hns/hns_roce_sysfs.c index 18f4f60e0526..8d712b5b1091 100644 --- a/drivers/infiniband/hw/hns/hns_roce_sysfs.c +++ b/drivers/infiniband/hw/hns/hns_roce_sysfs.c @@ -414,6 +414,13 @@ int hns_roce_create_port_files(struct ib_device *ibdev, u8 port_num, } kobject_uevent(&pdata->kobj, KOBJ_ADD);
+ ret = alloc_scc_param(hr_dev, pdata); + if (ret) { + dev_err(hr_dev->dev, "alloc scc param failed, ret = %d!\n", + ret); + goto fail_kobj; + } + ret = sysfs_create_groups(&pdata->kobj, hns_attr_port_groups); if (ret) { ibdev_err(ibdev, @@ -422,18 +429,8 @@ int hns_roce_create_port_files(struct ib_device *ibdev, u8 port_num, goto fail_kobj; }
- ret = alloc_scc_param(hr_dev, pdata); - if (ret) { - dev_err(hr_dev->dev, "alloc scc param failed, ret = %d!\n", - ret); - goto fail_group; - } - return ret;
-fail_group: - sysfs_remove_groups(&pdata->kobj, hns_attr_port_groups); - fail_kobj: kobject_put(&pdata->kobj);