提交 c9bdad3c 编写于 作者: M Mike Marciniszyn 提交者: Roland Dreier

IB/qib: Correct qib_verbs_register_sysfs() error handling

qib_verbs_register_sysfs() never cleans up from a failure.
Additionally, the caller of qib_verbs_register_sysfs() doesn't
return the correct "ret" value.

This patch resolves both of those issues.
Reported-by: NWei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: NDean Luick <dean.luick@intel.com>
Signed-off-by: NMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: NRoland Dreier <roland@purestorage.com>
上级 137200a4
......@@ -808,10 +808,14 @@ int qib_verbs_register_sysfs(struct qib_devdata *dd)
for (i = 0; i < ARRAY_SIZE(qib_attributes); ++i) {
ret = device_create_file(&dev->dev, qib_attributes[i]);
if (ret)
return ret;
goto bail;
}
return 0;
bail:
for (i = 0; i < ARRAY_SIZE(qib_attributes); ++i)
device_remove_file(&dev->dev, qib_attributes[i]);
return ret;
}
/*
......
......@@ -2234,7 +2234,8 @@ int qib_register_ib_device(struct qib_devdata *dd)
if (ret)
goto err_agents;
if (qib_verbs_register_sysfs(dd))
ret = qib_verbs_register_sysfs(dd);
if (ret)
goto err_class;
goto bail;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册