linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: hisilicon - check if debugfs opened
@ 2021-03-27  8:33 Hui Tang
  2021-03-28 15:09 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Hui Tang @ 2021-03-27  8:33 UTC (permalink / raw)
  To: herbert, davem; +Cc: linux-crypto, xuzaibo, wangzhou1, linux-kernel

'xx_debugfs_init' check if debugfs opened.

Signed-off-by: Hui Tang <tanghui20@huawei.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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-30 12:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-27  8:33 [PATCH] crypto: hisilicon - check if debugfs opened Hui Tang
2021-03-28 15:09 ` Greg KH
2021-03-30 12:09   ` tanghui20
2021-03-30 12:23     ` Greg KH
2021-03-30 12:40       ` tanghui20
2021-03-30 12:45         ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).