crypto: hisilicon - Adjust debugfs creation and release order
authorChenghai Huang <huangchenghai2@huawei.com>
Sun, 7 Apr 2024 07:59:57 +0000 (15:59 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 12 Apr 2024 07:07:53 +0000 (15:07 +0800)
commit0a6e038f0c4d9a5d5f638757fa03ef6ffc550b6a
tree0102f743b75e57a33a4c17c6d7c03819f337163b
parent56f37ceaf4409d0c3a69101b7ea5d14eb6568f42
crypto: hisilicon - Adjust debugfs creation and release order

There is a scenario where the file directory is created but the
file memory is not set. In this case, if a user accesses the
file, an error occurs.

So during the creation process of debugfs, memory should be
allocated first before creating the directory. In the release
process, the directory should be deleted first before releasing
the memory to avoid the situation where the memory does not
exist when accessing the directory.

In addition, the directory released by the debugfs is a global
variable. When the debugfs of an accelerator fails to be
initialized, releasing the directory of the global variable
affects the debugfs initialization of other accelerators.
The debugfs root directory released by debugfs init should be a
member of qm, not a global variable.

Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/hisilicon/hpre/hpre_main.c
drivers/crypto/hisilicon/sec2/sec_main.c
drivers/crypto/hisilicon/zip/zip_main.c