Loading
RDMA/hns: Fix remove debugfs after device has been unregistered
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IBV8UW ---------------------------------------------------------------------- hns_roce_unregister_device() will be problematic if it is in front of hns_roce_unregister_debugfs(), hns_roce_unregister_device() will free up ib_deivce, and there will be a risk if debugfs uses ib_deivce. Conversely, if hns_roce_unregister_debugfs() is in front of hns_roce_unregister_device(), when the driver is uninstalled, the former will delete the entire debugfs directory, and the latter will destroy all the debugfs subdirectories of uctx, and an error will occur because the debugfs directory of uctx no longer exists. Now put hns_roce_unregister_debugfs() in front of hns_roce_unregister_device () and leave the all debugfs root NULL after hns_roce_unregister_debugfs(), so that call hns_roce_unregister_device () again, if the debugfs directory of uctx is determined to be empty, return it directly without throwing an error. The above problems can be solved in this patch. Fixes: 640cb088 ("RDMA/hns: Add debugfs support for DCA") Signed-off-by:Yuyu Li <liyuyu6@huawei.com> Signed-off-by:
Xinghai Cen <cenxinghai@h-partners.com>