Skip to content

Commit

Permalink
crypto: ccree - Remove debugfs when platform_driver_register failed
Browse files Browse the repository at this point in the history
When platform_driver_register failed, we need to remove debugfs,
which will caused a resource leak, fix it.

Failed logs as follows:
[   32.606488] debugfs: Directory 'ccree' with parent '/' already present!

Fixes: 4c3f972 ("crypto: ccree - introduce CryptoCell driver")
Signed-off-by: Gaosheng Cui <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
gscui authored and herbertx committed Nov 18, 2022
1 parent 7cdc5e6 commit 4f1c596
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/crypto/ccree/cc_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,17 @@ static struct platform_driver ccree_driver = {

static int __init ccree_init(void)
{
int rc;

cc_debugfs_global_init();

return platform_driver_register(&ccree_driver);
rc = platform_driver_register(&ccree_driver);
if (rc) {
cc_debugfs_global_fini();
return rc;
}

return 0;
}
module_init(ccree_init);

Expand Down

0 comments on commit 4f1c596

Please sign in to comment.