提交 723b68db 编写于 作者: G Gaosheng Cui 提交者: sanglipeng

bnxt_en: Remove debugfs when pci_register_driver failed

stable inclusion
from stable-v5.10.156
commit d6a561bd4c53c5fc8cade48a555d3dc6acfb2c5b
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7MCG1

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=d6a561bd4c53c5fc8cade48a555d3dc6acfb2c5b

--------------------------------

[ Upstream commit 991aef4e ]

When pci_register_driver failed, we need to remove debugfs,
which will caused a resource leak, fix it.

Resource leak logs as follows:
[   52.184456] debugfs: Directory 'bnxt_en' with parent '/' already present!

Fixes: cabfb09d ("bnxt_en: add debugfs support for DIM")
Signed-off-by: NGaosheng Cui <cuigaosheng1@huawei.com>
Reviewed-by: NLeon Romanovsky <leonro@nvidia.com>
Reviewed-by: NMichael Chan <michael.chan@broadcom.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: Nsanglipeng <sanglipeng1@jd.com>
上级 fcd12a85
......@@ -13111,8 +13111,16 @@ static struct pci_driver bnxt_pci_driver = {
static int __init bnxt_init(void)
{
int err;
bnxt_debug_init();
return pci_register_driver(&bnxt_pci_driver);
err = pci_register_driver(&bnxt_pci_driver);
if (err) {
bnxt_debug_exit();
return err;
}
return 0;
}
static void __exit bnxt_exit(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册