[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1616833980-11006-1-git-send-email-tanghui20@huawei.com>
Date: Sat, 27 Mar 2021 16:33:00 +0800
From: Hui Tang <tanghui20@...wei.com>
To: <herbert@...dor.apana.org.au>, <davem@...emloft.net>
CC: <linux-crypto@...r.kernel.org>, <xuzaibo@...wei.com>,
<wangzhou1@...ilicon.com>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] crypto: hisilicon - check if debugfs opened
'xx_debugfs_init' check if debugfs opened.
Signed-off-by: Hui Tang <tanghui20@...wei.com>
---
drivers/crypto/hisilicon/hpre/hpre_main.c | 5 ++++-
drivers/crypto/hisilicon/qm.c | 3 +++
drivers/crypto/hisilicon/sec2/sec_main.c | 5 ++++-
drivers/crypto/hisilicon/zip/zip_main.c | 3 +++
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c
index c7ab06d..f2605c4 100644
--- a/drivers/crypto/hisilicon/hpre/hpre_main.c
+++ b/drivers/crypto/hisilicon/hpre/hpre_main.c
@@ -779,6 +779,9 @@ static int hpre_debugfs_init(struct hisi_qm *qm)
struct device *dev = &qm->pdev->dev;
int ret;
+ if (!debugfs_initialized())
+ return -ENOENT;
+
qm->debug.debug_root = debugfs_create_dir(dev_name(dev),
hpre_debugfs_root);
@@ -949,7 +952,7 @@ static int hpre_probe(struct pci_dev *pdev, const struct pci_device_id *id)
ret = hpre_debugfs_init(qm);
if (ret)
- dev_warn(&pdev->dev, "init debugfs fail!\n");
+ dev_warn(&pdev->dev, "init debugfs fail (%d)!\n", ret);
ret = hisi_qm_alg_register(qm, &hpre_devices);
if (ret < 0) {
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index bc23174..14f2656 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -2926,6 +2926,9 @@ void hisi_qm_debug_init(struct hisi_qm *qm)
void *data;
int i;
+ if (!debugfs_initialized())
+ return;
+
qm_d = debugfs_create_dir("qm", qm->debug.debug_root);
qm->debug.qm_d = qm_d;
diff --git a/drivers/crypto/hisilicon/sec2/sec_main.c b/drivers/crypto/hisilicon/sec2/sec_main.c
index 78a6043..226475d 100644
--- a/drivers/crypto/hisilicon/sec2/sec_main.c
+++ b/drivers/crypto/hisilicon/sec2/sec_main.c
@@ -695,6 +695,9 @@ static int sec_debugfs_init(struct hisi_qm *qm)
struct device *dev = &qm->pdev->dev;
int ret;
+ if (!debugfs_initialized())
+ return -ENOENT;
+
qm->debug.debug_root = debugfs_create_dir(dev_name(dev),
sec_debugfs_root);
qm->debug.sqe_mask_offset = SEC_SQE_MASK_OFFSET;
@@ -928,7 +931,7 @@ static int sec_probe(struct pci_dev *pdev, const struct pci_device_id *id)
ret = sec_debugfs_init(qm);
if (ret)
- pci_warn(pdev, "Failed to init debugfs!\n");
+ pci_warn(pdev, "Failed to init debugfs (%d)!\n", ret);
ret = hisi_qm_alg_register(qm, &sec_devices);
if (ret < 0) {
diff --git a/drivers/crypto/hisilicon/zip/zip_main.c b/drivers/crypto/hisilicon/zip/zip_main.c
index 02c44572..4b111c0 100644
--- a/drivers/crypto/hisilicon/zip/zip_main.c
+++ b/drivers/crypto/hisilicon/zip/zip_main.c
@@ -600,6 +600,9 @@ static int hisi_zip_debugfs_init(struct hisi_qm *qm)
struct dentry *dev_d;
int ret;
+ if (!debugfs_initialized())
+ return -ENOENT;
+
dev_d = debugfs_create_dir(dev_name(dev), hzip_debugfs_root);
qm->debug.sqe_mask_offset = HZIP_SQE_MASK_OFFSET;
--
2.8.1
Powered by blists - more mailing lists