Skip to content

Commit

Permalink
bnxt_en: Remove debugfs when pci_register_driver failed
Browse files Browse the repository at this point in the history
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: cabfb09 ("bnxt_en: add debugfs support for DIM")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Gaosheng Cui authored and David S. Miller committed Nov 14, 2022
1 parent 8fbb53c commit 991aef4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -14037,8 +14037,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)
Expand Down

0 comments on commit 991aef4

Please sign in to comment.