diff options
author | Gaosheng Cui <cuigaosheng1@huawei.com> | 2022-11-08 16:29:12 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2022-11-18 16:59:34 +0800 |
commit | 4f1c596df706c9aca662b6c214fad84047ae2a97 (patch) | |
tree | 49842a00442e727e12405efc2c26007c1f2a8f73 /drivers/crypto/ccree | |
parent | 7cdc5e6bcd02ab45d0a2991b35861b448e355276 (diff) | |
download | linux-4f1c596df706c9aca662b6c214fad84047ae2a97.tar.gz linux-4f1c596df706c9aca662b6c214fad84047ae2a97.tar.bz2 linux-4f1c596df706c9aca662b6c214fad84047ae2a97.zip |
crypto: ccree - Remove debugfs when platform_driver_register failed
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: 4c3f97276e15 ("crypto: ccree - introduce CryptoCell driver")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ccree')
-rw-r--r-- | drivers/crypto/ccree/cc_driver.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/crypto/ccree/cc_driver.c b/drivers/crypto/ccree/cc_driver.c index cadead18b59e..d489c6f80892 100644 --- a/drivers/crypto/ccree/cc_driver.c +++ b/drivers/crypto/ccree/cc_driver.c @@ -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); |