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 | 23 ++++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_sysfs.c b/drivers/infiniband/hw/hns/hns_roce_sysfs.c index 42d6e888cc90..8950e7c4a2e4 100644 --- a/drivers/infiniband/hw/hns/hns_roce_sysfs.c +++ b/drivers/infiniband/hw/hns/hns_roce_sysfs.c @@ -568,32 +568,29 @@ int hns_roce_create_port_files(struct ib_device *ibdev, u8 port_num, } kobject_uevent(&pdata->kobj, KOBJ_ADD);
- ret = sysfs_create_groups(&pdata->kobj, hns_attr_port_groups); - if (ret) { - ibdev_err(ibdev, - "fail to create port(%u) cc param sysfs, ret = %d.\n", - port_num, ret); - 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; + goto fail_kobj; }
ret = alloc_cnp_pri_param(hr_dev, pdata); if (ret) { dev_err(hr_dev->dev, "alloc cnp pri param failed, ret = %d!\n", ret); - goto fail_group; + goto fail_kobj; }
- return ret; + ret = sysfs_create_groups(&pdata->kobj, hns_attr_port_groups); + if (ret) { + ibdev_err(ibdev, + "fail to create port(%u) cc param sysfs, ret = %d.\n", + port_num, ret); + goto fail_kobj; + }
-fail_group: - sysfs_remove_groups(&pdata->kobj, hns_attr_port_groups); + return ret;
fail_kobj: kobject_put(&pdata->kobj);