* [PATCH net] bnxt_en: Remove debugfs when pci_register_driver failed
@ 2022-11-11 7:04 Gaosheng Cui
2022-11-13 8:02 ` Leon Romanovsky
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Gaosheng Cui @ 2022-11-11 7:04 UTC (permalink / raw)
To: michael.chan, davem, edumazet, kuba, pabeni, gospo, cuigaosheng1; +Cc: netdev
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: cabfb09d87bd ("bnxt_en: add debugfs support for DIM")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 743504a27b71..0fe164b42c5d 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -14059,8 +14059,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)
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net] bnxt_en: Remove debugfs when pci_register_driver failed
2022-11-11 7:04 [PATCH net] bnxt_en: Remove debugfs when pci_register_driver failed Gaosheng Cui
@ 2022-11-13 8:02 ` Leon Romanovsky
2022-11-13 19:25 ` Michael Chan
2022-11-14 11:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2022-11-13 8:02 UTC (permalink / raw)
To: Gaosheng Cui; +Cc: michael.chan, davem, edumazet, kuba, pabeni, gospo, netdev
On Fri, Nov 11, 2022 at 03:04:33PM +0800, Gaosheng Cui wrote:
> 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: cabfb09d87bd ("bnxt_en: add debugfs support for DIM")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> ---
> drivers/net/ethernet/broadcom/bnxt/bnxt.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index 743504a27b71..0fe164b42c5d 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -14059,8 +14059,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;
> }
>
Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net] bnxt_en: Remove debugfs when pci_register_driver failed
2022-11-11 7:04 [PATCH net] bnxt_en: Remove debugfs when pci_register_driver failed Gaosheng Cui
2022-11-13 8:02 ` Leon Romanovsky
@ 2022-11-13 19:25 ` Michael Chan
2022-11-14 11:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Michael Chan @ 2022-11-13 19:25 UTC (permalink / raw)
To: Gaosheng Cui; +Cc: davem, edumazet, kuba, pabeni, gospo, netdev
[-- Attachment #1: Type: text/plain, Size: 486 bytes --]
On Thu, Nov 10, 2022 at 11:04 PM Gaosheng Cui <cuigaosheng1@huawei.com> wrote:
>
> 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: cabfb09d87bd ("bnxt_en: add debugfs support for DIM")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Thanks.
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net] bnxt_en: Remove debugfs when pci_register_driver failed
2022-11-11 7:04 [PATCH net] bnxt_en: Remove debugfs when pci_register_driver failed Gaosheng Cui
2022-11-13 8:02 ` Leon Romanovsky
2022-11-13 19:25 ` Michael Chan
@ 2022-11-14 11:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-14 11:00 UTC (permalink / raw)
To: cuigaosheng; +Cc: michael.chan, davem, edumazet, kuba, pabeni, gospo, netdev
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:
On Fri, 11 Nov 2022 15:04:33 +0800 you wrote:
> 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: cabfb09d87bd ("bnxt_en: add debugfs support for DIM")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
>
> [...]
Here is the summary with links:
- [net] bnxt_en: Remove debugfs when pci_register_driver failed
https://git.kernel.org/netdev/net/c/991aef4ee4f6
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-14 11:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-11 7:04 [PATCH net] bnxt_en: Remove debugfs when pci_register_driver failed Gaosheng Cui
2022-11-13 8:02 ` Leon Romanovsky
2022-11-13 19:25 ` Michael Chan
2022-11-14 11:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).