When calling debugfs code, there is no need to ever check the return
value of the call, as no logic should ever change if a call works
properly or not. Fix up a bunch of crypto-specific code to not care
about the results of debugfs.
Greg Kroah-Hartman (7):
crypto: qat: no need to check return value of debugfs_create functions
crypto: ccrree: no need to check return value of debugfs_create
functions
crypto: axis: no need to check return value of debugfs_create
functions
crypto: cavium: zip: no need to check return value of debugfs_create
functions
crypto: cavium: nitrox: no need to check return value of
debugfs_create functions
crypto: ccp: no need to check return value of debugfs_create functions
crypto: caam: no need to check return value of debugfs_create
functions
drivers/crypto/axis/artpec6_crypto.c | 9 ----
drivers/crypto/caam/ctrl.c | 21 +++-----
drivers/crypto/caam/intern.h | 1 -
drivers/crypto/cavium/nitrox/nitrox_debugfs.c | 27 ++--------
drivers/crypto/cavium/nitrox/nitrox_debugfs.h | 5 +-
drivers/crypto/cavium/nitrox/nitrox_main.c | 4 +-
drivers/crypto/cavium/zip/zip_main.c | 52 ++++---------------
drivers/crypto/ccp/ccp-debugfs.c | 36 +++----------
drivers/crypto/ccree/cc_debugfs.c | 22 ++------
drivers/crypto/ccree/cc_debugfs.h | 8 +--
drivers/crypto/ccree/cc_driver.c | 7 +--
drivers/crypto/qat/qat_c3xxx/adf_drv.c | 5 --
drivers/crypto/qat/qat_c3xxxvf/adf_drv.c | 5 --
drivers/crypto/qat/qat_c62x/adf_drv.c | 5 --
drivers/crypto/qat/qat_c62xvf/adf_drv.c | 5 --
drivers/crypto/qat/qat_common/adf_cfg.c | 7 ---
drivers/crypto/qat/qat_common/adf_transport.c | 6 ---
.../qat/qat_common/adf_transport_debug.c | 15 ------
drivers/crypto/qat/qat_dh895xcc/adf_drv.c | 5 --
drivers/crypto/qat/qat_dh895xccvf/adf_drv.c | 5 --
20 files changed, 38 insertions(+), 212 deletions(-)
--
2.20.1
When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.
Cc: Giovanni Cabiddu <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Conor McLoughlin <[email protected]>
Cc: Waiman Long <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/crypto/qat/qat_c3xxx/adf_drv.c | 5 -----
drivers/crypto/qat/qat_c3xxxvf/adf_drv.c | 5 -----
drivers/crypto/qat/qat_c62x/adf_drv.c | 5 -----
drivers/crypto/qat/qat_c62xvf/adf_drv.c | 5 -----
drivers/crypto/qat/qat_common/adf_cfg.c | 7 -------
drivers/crypto/qat/qat_common/adf_transport.c | 6 ------
.../crypto/qat/qat_common/adf_transport_debug.c | 15 ---------------
drivers/crypto/qat/qat_dh895xcc/adf_drv.c | 5 -----
drivers/crypto/qat/qat_dh895xccvf/adf_drv.c | 5 -----
9 files changed, 58 deletions(-)
diff --git a/drivers/crypto/qat/qat_c3xxx/adf_drv.c b/drivers/crypto/qat/qat_c3xxx/adf_drv.c
index 763c2166ee0e..d937cc7248a5 100644
--- a/drivers/crypto/qat/qat_c3xxx/adf_drv.c
+++ b/drivers/crypto/qat/qat_c3xxx/adf_drv.c
@@ -193,11 +193,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
PCI_FUNC(pdev->devfn));
accel_dev->debugfs_dir = debugfs_create_dir(name, NULL);
- if (!accel_dev->debugfs_dir) {
- dev_err(&pdev->dev, "Could not create debugfs dir %s\n", name);
- ret = -EINVAL;
- goto out_err;
- }
/* Create device configuration table */
ret = adf_cfg_dev_add(accel_dev);
diff --git a/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c b/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c
index 613c7d5644ce..1dc5ac859f7b 100644
--- a/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c
+++ b/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c
@@ -177,11 +177,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
PCI_FUNC(pdev->devfn));
accel_dev->debugfs_dir = debugfs_create_dir(name, NULL);
- if (!accel_dev->debugfs_dir) {
- dev_err(&pdev->dev, "Could not create debugfs dir %s\n", name);
- ret = -EINVAL;
- goto out_err;
- }
/* Create device configuration table */
ret = adf_cfg_dev_add(accel_dev);
diff --git a/drivers/crypto/qat/qat_c62x/adf_drv.c b/drivers/crypto/qat/qat_c62x/adf_drv.c
index 9cb832963357..2bc06c89d2fe 100644
--- a/drivers/crypto/qat/qat_c62x/adf_drv.c
+++ b/drivers/crypto/qat/qat_c62x/adf_drv.c
@@ -193,11 +193,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
PCI_FUNC(pdev->devfn));
accel_dev->debugfs_dir = debugfs_create_dir(name, NULL);
- if (!accel_dev->debugfs_dir) {
- dev_err(&pdev->dev, "Could not create debugfs dir %s\n", name);
- ret = -EINVAL;
- goto out_err;
- }
/* Create device configuration table */
ret = adf_cfg_dev_add(accel_dev);
diff --git a/drivers/crypto/qat/qat_c62xvf/adf_drv.c b/drivers/crypto/qat/qat_c62xvf/adf_drv.c
index 278452b8ef81..a68358b31292 100644
--- a/drivers/crypto/qat/qat_c62xvf/adf_drv.c
+++ b/drivers/crypto/qat/qat_c62xvf/adf_drv.c
@@ -177,11 +177,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
PCI_FUNC(pdev->devfn));
accel_dev->debugfs_dir = debugfs_create_dir(name, NULL);
- if (!accel_dev->debugfs_dir) {
- dev_err(&pdev->dev, "Could not create debugfs dir %s\n", name);
- ret = -EINVAL;
- goto out_err;
- }
/* Create device configuration table */
ret = adf_cfg_dev_add(accel_dev);
diff --git a/drivers/crypto/qat/qat_common/adf_cfg.c b/drivers/crypto/qat/qat_common/adf_cfg.c
index d0879790561f..5c7fdb0fc53d 100644
--- a/drivers/crypto/qat/qat_common/adf_cfg.c
+++ b/drivers/crypto/qat/qat_common/adf_cfg.c
@@ -141,13 +141,6 @@ int adf_cfg_dev_add(struct adf_accel_dev *accel_dev)
accel_dev->debugfs_dir,
dev_cfg_data,
&qat_dev_cfg_fops);
- if (!dev_cfg_data->debug) {
- dev_err(&GET_DEV(accel_dev),
- "Failed to create qat cfg debugfs entry.\n");
- kfree(dev_cfg_data);
- accel_dev->cfg = NULL;
- return -EFAULT;
- }
return 0;
}
EXPORT_SYMBOL_GPL(adf_cfg_dev_add);
diff --git a/drivers/crypto/qat/qat_common/adf_transport.c b/drivers/crypto/qat/qat_common/adf_transport.c
index 57d2622728a5..ac658ce46836 100644
--- a/drivers/crypto/qat/qat_common/adf_transport.c
+++ b/drivers/crypto/qat/qat_common/adf_transport.c
@@ -486,12 +486,6 @@ int adf_init_etr_data(struct adf_accel_dev *accel_dev)
/* accel_dev->debugfs_dir should always be non-NULL here */
etr_data->debug = debugfs_create_dir("transport",
accel_dev->debugfs_dir);
- if (!etr_data->debug) {
- dev_err(&GET_DEV(accel_dev),
- "Unable to create transport debugfs entry\n");
- ret = -ENOENT;
- goto err_bank_debug;
- }
for (i = 0; i < num_banks; i++) {
ret = adf_init_bank(accel_dev, &etr_data->banks[i], i,
diff --git a/drivers/crypto/qat/qat_common/adf_transport_debug.c b/drivers/crypto/qat/qat_common/adf_transport_debug.c
index 52340b9bb387..e794e9d97b2c 100644
--- a/drivers/crypto/qat/qat_common/adf_transport_debug.c
+++ b/drivers/crypto/qat/qat_common/adf_transport_debug.c
@@ -163,11 +163,6 @@ int adf_ring_debugfs_add(struct adf_etr_ring_data *ring, const char *name)
ring_debug->debug = debugfs_create_file(entry_name, S_IRUSR,
ring->bank->bank_debug_dir,
ring, &adf_ring_debug_fops);
- if (!ring_debug->debug) {
- pr_err("QAT: Failed to create ring debug entry.\n");
- kfree(ring_debug);
- return -EFAULT;
- }
ring->ring_debug = ring_debug;
return 0;
}
@@ -271,19 +266,9 @@ int adf_bank_debugfs_add(struct adf_etr_bank_data *bank)
snprintf(name, sizeof(name), "bank_%02d", bank->bank_number);
bank->bank_debug_dir = debugfs_create_dir(name, parent);
- if (!bank->bank_debug_dir) {
- pr_err("QAT: Failed to create bank debug dir.\n");
- return -EFAULT;
- }
-
bank->bank_debug_cfg = debugfs_create_file("config", S_IRUSR,
bank->bank_debug_dir, bank,
&adf_bank_debug_fops);
- if (!bank->bank_debug_cfg) {
- pr_err("QAT: Failed to create bank debug entry.\n");
- debugfs_remove(bank->bank_debug_dir);
- return -EFAULT;
- }
return 0;
}
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c
index 3a9708ef4ce2..b11bf8c0e683 100644
--- a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c
+++ b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c
@@ -193,11 +193,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
PCI_FUNC(pdev->devfn));
accel_dev->debugfs_dir = debugfs_create_dir(name, NULL);
- if (!accel_dev->debugfs_dir) {
- dev_err(&pdev->dev, "Could not create debugfs dir %s\n", name);
- ret = -EINVAL;
- goto out_err;
- }
/* Create device configuration table */
ret = adf_cfg_dev_add(accel_dev);
diff --git a/drivers/crypto/qat/qat_dh895xccvf/adf_drv.c b/drivers/crypto/qat/qat_dh895xccvf/adf_drv.c
index 3da0f951cb59..1b762eefc6c1 100644
--- a/drivers/crypto/qat/qat_dh895xccvf/adf_drv.c
+++ b/drivers/crypto/qat/qat_dh895xccvf/adf_drv.c
@@ -177,11 +177,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
PCI_FUNC(pdev->devfn));
accel_dev->debugfs_dir = debugfs_create_dir(name, NULL);
- if (!accel_dev->debugfs_dir) {
- dev_err(&pdev->dev, "Could not create debugfs dir %s\n", name);
- ret = -EINVAL;
- goto out_err;
- }
/* Create device configuration table */
ret = adf_cfg_dev_add(accel_dev);
--
2.20.1
When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.
Cc: Herbert Xu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Srikanth Jampala <[email protected]>
Cc: Yangtao Li <[email protected]>
Cc: Gadam Sreerama <[email protected]>
Cc: Eric Biggers <[email protected]>
Cc: [email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/crypto/cavium/nitrox/nitrox_debugfs.c | 27 ++++---------------
drivers/crypto/cavium/nitrox/nitrox_debugfs.h | 5 ++--
drivers/crypto/cavium/nitrox/nitrox_main.c | 4 +--
3 files changed, 8 insertions(+), 28 deletions(-)
diff --git a/drivers/crypto/cavium/nitrox/nitrox_debugfs.c b/drivers/crypto/cavium/nitrox/nitrox_debugfs.c
index 0196b992280f..848ec93d4333 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_debugfs.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_debugfs.c
@@ -55,31 +55,14 @@ void nitrox_debugfs_exit(struct nitrox_device *ndev)
ndev->debugfs_dir = NULL;
}
-int nitrox_debugfs_init(struct nitrox_device *ndev)
+void nitrox_debugfs_init(struct nitrox_device *ndev)
{
- struct dentry *dir, *f;
+ struct dentry *dir;
dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
- if (!dir)
- return -ENOMEM;
ndev->debugfs_dir = dir;
- f = debugfs_create_file("firmware", 0400, dir, ndev,
- &firmware_fops);
- if (!f)
- goto err;
- f = debugfs_create_file("device", 0400, dir, ndev,
- &device_fops);
- if (!f)
- goto err;
- f = debugfs_create_file("stats", 0400, dir, ndev,
- &stats_fops);
- if (!f)
- goto err;
-
- return 0;
-
-err:
- nitrox_debugfs_exit(ndev);
- return -ENODEV;
+ debugfs_create_file("firmware", 0400, dir, ndev, &firmware_fops);
+ debugfs_create_file("device", 0400, dir, ndev, &device_fops);
+ debugfs_create_file("stats", 0400, dir, ndev, &stats_fops);
}
diff --git a/drivers/crypto/cavium/nitrox/nitrox_debugfs.h b/drivers/crypto/cavium/nitrox/nitrox_debugfs.h
index a8d85ffa619c..f177b79bbab0 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_debugfs.h
+++ b/drivers/crypto/cavium/nitrox/nitrox_debugfs.h
@@ -5,12 +5,11 @@
#include "nitrox_dev.h"
#ifdef CONFIG_DEBUG_FS
-int nitrox_debugfs_init(struct nitrox_device *ndev);
+void nitrox_debugfs_init(struct nitrox_device *ndev);
void nitrox_debugfs_exit(struct nitrox_device *ndev);
#else
-static inline int nitrox_debugfs_init(struct nitrox_device *ndev)
+static inline void nitrox_debugfs_init(struct nitrox_device *ndev)
{
- return 0;
}
static inline void nitrox_debugfs_exit(struct nitrox_device *ndev)
diff --git a/drivers/crypto/cavium/nitrox/nitrox_main.c b/drivers/crypto/cavium/nitrox/nitrox_main.c
index 014e9863c20e..faa78f651238 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_main.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_main.c
@@ -404,9 +404,7 @@ static int nitrox_probe(struct pci_dev *pdev,
if (err)
goto pf_hw_fail;
- err = nitrox_debugfs_init(ndev);
- if (err)
- goto pf_hw_fail;
+ nitrox_debugfs_init(ndev);
/* clear the statistics */
atomic64_set(&ndev->stats.posted, 0);
--
2.20.1
When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.
Cc: "Horia Geantă" <[email protected]>
Cc: Aymen Sghaier <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: [email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/crypto/caam/ctrl.c | 21 ++++++---------------
drivers/crypto/caam/intern.h | 1 -
2 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 16bbc72f041a..87c13fb6028c 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -863,27 +863,18 @@ static int caam_probe(struct platform_device *pdev)
/* Internal covering keys (useful in non-secure mode only) */
ctrlpriv->ctl_kek_wrap.data = (__force void *)&ctrlpriv->ctrl->kek[0];
ctrlpriv->ctl_kek_wrap.size = KEK_KEY_SIZE * sizeof(u32);
- ctrlpriv->ctl_kek = debugfs_create_blob("kek",
- S_IRUSR |
- S_IRGRP | S_IROTH,
- ctrlpriv->ctl,
- &ctrlpriv->ctl_kek_wrap);
+ debugfs_create_blob("kek", S_IRUSR | S_IRGRP | S_IROTH, ctrlpriv->ctl,
+ &ctrlpriv->ctl_kek_wrap);
ctrlpriv->ctl_tkek_wrap.data = (__force void *)&ctrlpriv->ctrl->tkek[0];
ctrlpriv->ctl_tkek_wrap.size = KEK_KEY_SIZE * sizeof(u32);
- ctrlpriv->ctl_tkek = debugfs_create_blob("tkek",
- S_IRUSR |
- S_IRGRP | S_IROTH,
- ctrlpriv->ctl,
- &ctrlpriv->ctl_tkek_wrap);
+ debugfs_create_blob("tkek", S_IRUSR | S_IRGRP | S_IROTH, ctrlpriv->ctl,
+ &ctrlpriv->ctl_tkek_wrap);
ctrlpriv->ctl_tdsk_wrap.data = (__force void *)&ctrlpriv->ctrl->tdsk[0];
ctrlpriv->ctl_tdsk_wrap.size = KEK_KEY_SIZE * sizeof(u32);
- ctrlpriv->ctl_tdsk = debugfs_create_blob("tdsk",
- S_IRUSR |
- S_IRGRP | S_IROTH,
- ctrlpriv->ctl,
- &ctrlpriv->ctl_tdsk_wrap);
+ debugfs_create_blob("tdsk", S_IRUSR | S_IRGRP | S_IROTH, ctrlpriv->ctl,
+ &ctrlpriv->ctl_tdsk_wrap);
#endif
return 0;
diff --git a/drivers/crypto/caam/intern.h b/drivers/crypto/caam/intern.h
index babc78abd155..5869ad58d497 100644
--- a/drivers/crypto/caam/intern.h
+++ b/drivers/crypto/caam/intern.h
@@ -106,7 +106,6 @@ struct caam_drv_private {
struct dentry *dfs_root;
struct dentry *ctl; /* controller dir */
struct debugfs_blob_wrapper ctl_kek_wrap, ctl_tkek_wrap, ctl_tdsk_wrap;
- struct dentry *ctl_kek, *ctl_tkek, *ctl_tdsk;
#endif
};
--
2.20.1
When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.
Cc: Tom Lendacky <[email protected]>
Cc: Gary Hook <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: [email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/crypto/ccp/ccp-debugfs.c | 36 +++++++-------------------------
1 file changed, 7 insertions(+), 29 deletions(-)
diff --git a/drivers/crypto/ccp/ccp-debugfs.c b/drivers/crypto/ccp/ccp-debugfs.c
index 1a734bd2070a..4bd26af7098d 100644
--- a/drivers/crypto/ccp/ccp-debugfs.c
+++ b/drivers/crypto/ccp/ccp-debugfs.c
@@ -286,10 +286,7 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)
{
struct ccp_cmd_queue *cmd_q;
char name[MAX_NAME_LEN + 1];
- struct dentry *debugfs_info;
- struct dentry *debugfs_stats;
struct dentry *debugfs_q_instance;
- struct dentry *debugfs_q_stats;
int i;
if (!debugfs_initialized())
@@ -299,24 +296,14 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)
if (!ccp_debugfs_dir)
ccp_debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
mutex_unlock(&ccp_debugfs_lock);
- if (!ccp_debugfs_dir)
- return;
ccp->debugfs_instance = debugfs_create_dir(ccp->name, ccp_debugfs_dir);
- if (!ccp->debugfs_instance)
- goto err;
- debugfs_info = debugfs_create_file("info", 0400,
- ccp->debugfs_instance, ccp,
- &ccp_debugfs_info_ops);
- if (!debugfs_info)
- goto err;
+ debugfs_create_file("info", 0400, ccp->debugfs_instance, ccp,
+ &ccp_debugfs_info_ops);
- debugfs_stats = debugfs_create_file("stats", 0600,
- ccp->debugfs_instance, ccp,
- &ccp_debugfs_stats_ops);
- if (!debugfs_stats)
- goto err;
+ debugfs_create_file("stats", 0600, ccp->debugfs_instance, ccp,
+ &ccp_debugfs_stats_ops);
for (i = 0; i < ccp->cmd_q_count; i++) {
cmd_q = &ccp->cmd_q[i];
@@ -325,21 +312,12 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)
debugfs_q_instance =
debugfs_create_dir(name, ccp->debugfs_instance);
- if (!debugfs_q_instance)
- goto err;
-
- debugfs_q_stats =
- debugfs_create_file("stats", 0600,
- debugfs_q_instance, cmd_q,
- &ccp_debugfs_queue_ops);
- if (!debugfs_q_stats)
- goto err;
+
+ debugfs_create_file("stats", 0600, debugfs_q_instance, cmd_q,
+ &ccp_debugfs_queue_ops);
}
return;
-
-err:
- debugfs_remove_recursive(ccp->debugfs_instance);
}
void ccp5_debugfs_destroy(void)
--
2.20.1
When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.
Cc: Herbert Xu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Robert Richter <[email protected]>
Cc: Jan Glauber <[email protected]>
Cc: [email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/crypto/cavium/zip/zip_main.c | 52 ++++++----------------------
1 file changed, 11 insertions(+), 41 deletions(-)
diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
index be055b9547f6..e6b09e784e66 100644
--- a/drivers/crypto/cavium/zip/zip_main.c
+++ b/drivers/crypto/cavium/zip/zip_main.c
@@ -618,41 +618,23 @@ static const struct file_operations zip_regs_fops = {
/* Root directory for thunderx_zip debugfs entry */
static struct dentry *zip_debugfs_root;
-static int __init zip_debugfs_init(void)
+static void __init zip_debugfs_init(void)
{
- struct dentry *zip_stats, *zip_clear, *zip_regs;
-
if (!debugfs_initialized())
- return -ENODEV;
+ return;
zip_debugfs_root = debugfs_create_dir("thunderx_zip", NULL);
- if (!zip_debugfs_root)
- return -ENOMEM;
/* Creating files for entries inside thunderx_zip directory */
- zip_stats = debugfs_create_file("zip_stats", 0444,
- zip_debugfs_root,
- NULL, &zip_stats_fops);
- if (!zip_stats)
- goto failed_to_create;
-
- zip_clear = debugfs_create_file("zip_clear", 0444,
- zip_debugfs_root,
- NULL, &zip_clear_fops);
- if (!zip_clear)
- goto failed_to_create;
-
- zip_regs = debugfs_create_file("zip_regs", 0444,
- zip_debugfs_root,
- NULL, &zip_regs_fops);
- if (!zip_regs)
- goto failed_to_create;
+ debugfs_create_file("zip_stats", 0444, zip_debugfs_root, NULL,
+ &zip_stats_fops);
- return 0;
+ debugfs_create_file("zip_clear", 0444, zip_debugfs_root, NULL,
+ &zip_clear_fops);
+
+ debugfs_create_file("zip_regs", 0444, zip_debugfs_root, NULL,
+ &zip_regs_fops);
-failed_to_create:
- debugfs_remove_recursive(zip_debugfs_root);
- return -ENOENT;
}
static void __exit zip_debugfs_exit(void)
@@ -661,13 +643,8 @@ static void __exit zip_debugfs_exit(void)
}
#else
-static int __init zip_debugfs_init(void)
-{
- return 0;
-}
-
+static void __init zip_debugfs_init(void) { }
static void __exit zip_debugfs_exit(void) { }
-
#endif
/* debugfs - end */
@@ -691,17 +668,10 @@ static int __init zip_init_module(void)
}
/* comp-decomp statistics are handled with debugfs interface */
- ret = zip_debugfs_init();
- if (ret < 0) {
- zip_err("ZIP: debugfs initialization failed\n");
- goto err_crypto_unregister;
- }
+ zip_debugfs_init();
return ret;
-err_crypto_unregister:
- zip_unregister_compression_device();
-
err_pci_unregister:
pci_unregister_driver(&zip_driver);
return ret;
--
2.20.1
When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.
Cc: Jesper Nilsson <[email protected]>
Cc: Lars Persson <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/crypto/axis/artpec6_crypto.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c
index f3442c2bdbdc..1a1858cea979 100644
--- a/drivers/crypto/axis/artpec6_crypto.c
+++ b/drivers/crypto/axis/artpec6_crypto.c
@@ -2984,12 +2984,6 @@ static void artpec6_crypto_init_debugfs(void)
{
dbgfs_root = debugfs_create_dir("artpec6_crypto", NULL);
- if (!dbgfs_root || IS_ERR(dbgfs_root)) {
- dbgfs_root = NULL;
- pr_err("%s: Could not initialise debugfs!\n", MODULE_NAME);
- return;
- }
-
#ifdef CONFIG_FAULT_INJECTION
fault_create_debugfs_attr("fail_status_read", dbgfs_root,
&artpec6_crypto_fail_status_read);
@@ -3001,9 +2995,6 @@ static void artpec6_crypto_init_debugfs(void)
static void artpec6_crypto_free_debugfs(void)
{
- if (!dbgfs_root)
- return;
-
debugfs_remove_recursive(dbgfs_root);
dbgfs_root = NULL;
}
--
2.20.1
When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.
Cc: Yael Chemla <[email protected]>
Cc: Gilad Ben-Yossef <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: [email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/crypto/ccree/cc_debugfs.c | 22 +++-------------------
drivers/crypto/ccree/cc_debugfs.h | 8 ++------
drivers/crypto/ccree/cc_driver.c | 7 +------
3 files changed, 6 insertions(+), 31 deletions(-)
diff --git a/drivers/crypto/ccree/cc_debugfs.c b/drivers/crypto/ccree/cc_debugfs.c
index 5ca184e42483..5fa05a7bcf36 100644
--- a/drivers/crypto/ccree/cc_debugfs.c
+++ b/drivers/crypto/ccree/cc_debugfs.c
@@ -39,11 +39,9 @@ static struct debugfs_reg32 debug_regs[] = {
CC_DEBUG_REG(AXIM_MON_COMP),
};
-int __init cc_debugfs_global_init(void)
+void __init cc_debugfs_global_init(void)
{
cc_debugfs_dir = debugfs_create_dir("ccree", NULL);
-
- return !cc_debugfs_dir;
}
void __exit cc_debugfs_global_fini(void)
@@ -56,7 +54,6 @@ int cc_debugfs_init(struct cc_drvdata *drvdata)
struct device *dev = drvdata_to_dev(drvdata);
struct cc_debugfs_ctx *ctx;
struct debugfs_regset32 *regset;
- struct dentry *file;
debug_regs[0].offset = drvdata->sig_offset;
debug_regs[1].offset = drvdata->ver_offset;
@@ -74,22 +71,9 @@ int cc_debugfs_init(struct cc_drvdata *drvdata)
regset->base = drvdata->cc_base;
ctx->dir = debugfs_create_dir(drvdata->plat_dev->name, cc_debugfs_dir);
- if (!ctx->dir)
- return -ENFILE;
-
- file = debugfs_create_regset32("regs", 0400, ctx->dir, regset);
- if (!file) {
- debugfs_remove(ctx->dir);
- return -ENFILE;
- }
- file = debugfs_create_bool("coherent", 0400, ctx->dir,
- &drvdata->coherent);
-
- if (!file) {
- debugfs_remove_recursive(ctx->dir);
- return -ENFILE;
- }
+ debugfs_create_regset32("regs", 0400, ctx->dir, regset);
+ debugfs_create_bool("coherent", 0400, ctx->dir, &drvdata->coherent);
drvdata->debugfs = ctx;
diff --git a/drivers/crypto/ccree/cc_debugfs.h b/drivers/crypto/ccree/cc_debugfs.h
index 5b5320eca7d2..01cbd9a95659 100644
--- a/drivers/crypto/ccree/cc_debugfs.h
+++ b/drivers/crypto/ccree/cc_debugfs.h
@@ -5,7 +5,7 @@
#define __CC_DEBUGFS_H__
#ifdef CONFIG_DEBUG_FS
-int cc_debugfs_global_init(void);
+void cc_debugfs_global_init(void);
void cc_debugfs_global_fini(void);
int cc_debugfs_init(struct cc_drvdata *drvdata);
@@ -13,11 +13,7 @@ void cc_debugfs_fini(struct cc_drvdata *drvdata);
#else
-static inline int cc_debugfs_global_init(void)
-{
- return 0;
-}
-
+static inline void cc_debugfs_global_init(void) {}
static inline void cc_debugfs_global_fini(void) {}
static inline int cc_debugfs_init(struct cc_drvdata *drvdata)
diff --git a/drivers/crypto/ccree/cc_driver.c b/drivers/crypto/ccree/cc_driver.c
index 8ada308d72ee..662738e53ced 100644
--- a/drivers/crypto/ccree/cc_driver.c
+++ b/drivers/crypto/ccree/cc_driver.c
@@ -538,13 +538,8 @@ static struct platform_driver ccree_driver = {
static int __init ccree_init(void)
{
- int ret;
-
cc_hash_global_init();
-
- ret = cc_debugfs_global_init();
- if (ret)
- return ret;
+ cc_debugfs_global_init();
return platform_driver_register(&ccree_driver);
}
--
2.20.1
On 1/22/2019 5:14 PM, Greg Kroah-Hartman wrote:
> When calling debugfs functions, there is no need to ever check the
> return value. The function can work or not, but the code logic should
> never do something different based on this.
>
> Cc: "Horia Geant?" <[email protected]>
> Cc: Aymen Sghaier <[email protected]>
> Cc: Herbert Xu <[email protected]>
> Cc: "David S. Miller" <[email protected]>
> Cc: [email protected]
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
Reviewed-by: Horia Geant? <[email protected]>
Thanks,
Horia
On 1/22/19 9:14 AM, Greg Kroah-Hartman wrote:
> When calling debugfs functions, there is no need to ever check the
> return value. The function can work or not, but the code logic should
> never do something different based on this.
Stupid question(s) time.
If we don't care about failures (because the subsystem handles them
without our involvement) why do these functions even have return values?
Why haven't they been changed to void so that they reflect the current
style of intended use?
I realize I'm old fashioned, but if a failure occurs, I've always been
of a mind to kick out and not try to do any further work. But debugfs is
to be treated as an exception to that paradigm? Carry on, ignore errors,
don't worry about it?
That said,
Acked-by: Gary R Hook <[email protected]>
>
> Cc: Tom Lendacky <[email protected]>
> Cc: Gary Hook <[email protected]>
> Cc: Herbert Xu <[email protected]>
> Cc: "David S. Miller" <[email protected]>
> Cc: [email protected]
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
> drivers/crypto/ccp/ccp-debugfs.c | 36 +++++++-------------------------
> 1 file changed, 7 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/crypto/ccp/ccp-debugfs.c b/drivers/crypto/ccp/ccp-debugfs.c
> index 1a734bd2070a..4bd26af7098d 100644
> --- a/drivers/crypto/ccp/ccp-debugfs.c
> +++ b/drivers/crypto/ccp/ccp-debugfs.c
> @@ -286,10 +286,7 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)
> {
> struct ccp_cmd_queue *cmd_q;
> char name[MAX_NAME_LEN + 1];
> - struct dentry *debugfs_info;
> - struct dentry *debugfs_stats;
> struct dentry *debugfs_q_instance;
> - struct dentry *debugfs_q_stats;
> int i;
>
> if (!debugfs_initialized())
> @@ -299,24 +296,14 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)
> if (!ccp_debugfs_dir)
> ccp_debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
> mutex_unlock(&ccp_debugfs_lock);
> - if (!ccp_debugfs_dir)
> - return;
>
> ccp->debugfs_instance = debugfs_create_dir(ccp->name, ccp_debugfs_dir);
> - if (!ccp->debugfs_instance)
> - goto err;
>
> - debugfs_info = debugfs_create_file("info", 0400,
> - ccp->debugfs_instance, ccp,
> - &ccp_debugfs_info_ops);
> - if (!debugfs_info)
> - goto err;
> + debugfs_create_file("info", 0400, ccp->debugfs_instance, ccp,
> + &ccp_debugfs_info_ops);
>
> - debugfs_stats = debugfs_create_file("stats", 0600,
> - ccp->debugfs_instance, ccp,
> - &ccp_debugfs_stats_ops);
> - if (!debugfs_stats)
> - goto err;
> + debugfs_create_file("stats", 0600, ccp->debugfs_instance, ccp,
> + &ccp_debugfs_stats_ops);
>
> for (i = 0; i < ccp->cmd_q_count; i++) {
> cmd_q = &ccp->cmd_q[i];
> @@ -325,21 +312,12 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)
>
> debugfs_q_instance =
> debugfs_create_dir(name, ccp->debugfs_instance);
> - if (!debugfs_q_instance)
> - goto err;
> -
> - debugfs_q_stats =
> - debugfs_create_file("stats", 0600,
> - debugfs_q_instance, cmd_q,
> - &ccp_debugfs_queue_ops);
> - if (!debugfs_q_stats)
> - goto err;
> +
> + debugfs_create_file("stats", 0600, debugfs_q_instance, cmd_q,
> + &ccp_debugfs_queue_ops);
> }
>
> return;
> -
> -err:
> - debugfs_remove_recursive(ccp->debugfs_instance);
> }
>
> void ccp5_debugfs_destroy(void)
>
On Tue, Jan 22, 2019 at 10:06:54PM +0000, Gary R Hook wrote:
> On 1/22/19 9:14 AM, Greg Kroah-Hartman wrote:
> > When calling debugfs functions, there is no need to ever check the
> > return value. The function can work or not, but the code logic should
> > never do something different based on this.
>
> Stupid question(s) time.
>
> If we don't care about failures (because the subsystem handles them
> without our involvement) why do these functions even have return values?
> Why haven't they been changed to void so that they reflect the current
> style of intended use?
Because on "normal" operations, you use the return value for something
(i.e. a parent directory to pass to other functions, or a value so you
can remove the file later).
> I realize I'm old fashioned, but if a failure occurs, I've always been
> of a mind to kick out and not try to do any further work. But debugfs is
> to be treated as an exception to that paradigm? Carry on, ignore errors,
> don't worry about it?
Yes, that is the case here, it goes against what everyone normally
thinks about kernel development :)
thanks,
greg k-h
On 1/22/19 4:14 PM, Greg Kroah-Hartman wrote:
> When calling debugfs functions, there is no need to ever check the
> return value. The function can work or not, but the code logic should
> never do something different based on this.
>
> Cc: Jesper Nilsson <[email protected]>
> Cc: Lars Persson <[email protected]>
> Cc: Herbert Xu <[email protected]>
> Cc: "David S. Miller" <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
> drivers/crypto/axis/artpec6_crypto.c | 9 ---------
> 1 file changed, 9 deletions(-)
Acked-by: Lars Persson <[email protected]>
Thanks,
Lars
Hi,
On Tue, Jan 22, 2019 at 5:14 PM Greg Kroah-Hartman
<[email protected]> wrote:
>
> When calling debugfs functions, there is no need to ever check the
> return value. The function can work or not, but the code logic should
> never do something different based on this.
I get the part about not failing loading the driver just because some
debugs entry isn't available, but wont it be weird if
debugfs_create_dir() fails but debugfs_create_regset32() succeeds and
we suddenly have weird files in the debugfs root dir?
Not the end of the world of course but maybe it's better to avoid
trying to create the files if the directory is not available?
Thanks,
Gilad
>
> Cc: Yael Chemla <[email protected]>
> Cc: Gilad Ben-Yossef <[email protected]>
> Cc: Herbert Xu <[email protected]>
> Cc: "David S. Miller" <[email protected]>
> Cc: [email protected]
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
> drivers/crypto/ccree/cc_debugfs.c | 22 +++-------------------
> drivers/crypto/ccree/cc_debugfs.h | 8 ++------
> drivers/crypto/ccree/cc_driver.c | 7 +------
> 3 files changed, 6 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/crypto/ccree/cc_debugfs.c b/drivers/crypto/ccree/cc_debugfs.c
> index 5ca184e42483..5fa05a7bcf36 100644
> --- a/drivers/crypto/ccree/cc_debugfs.c
> +++ b/drivers/crypto/ccree/cc_debugfs.c
> @@ -39,11 +39,9 @@ static struct debugfs_reg32 debug_regs[] = {
> CC_DEBUG_REG(AXIM_MON_COMP),
> };
>
> -int __init cc_debugfs_global_init(void)
> +void __init cc_debugfs_global_init(void)
> {
> cc_debugfs_dir = debugfs_create_dir("ccree", NULL);
> -
> - return !cc_debugfs_dir;
> }
>
> void __exit cc_debugfs_global_fini(void)
> @@ -56,7 +54,6 @@ int cc_debugfs_init(struct cc_drvdata *drvdata)
> struct device *dev = drvdata_to_dev(drvdata);
> struct cc_debugfs_ctx *ctx;
> struct debugfs_regset32 *regset;
> - struct dentry *file;
>
> debug_regs[0].offset = drvdata->sig_offset;
> debug_regs[1].offset = drvdata->ver_offset;
> @@ -74,22 +71,9 @@ int cc_debugfs_init(struct cc_drvdata *drvdata)
> regset->base = drvdata->cc_base;
>
> ctx->dir = debugfs_create_dir(drvdata->plat_dev->name, cc_debugfs_dir);
> - if (!ctx->dir)
> - return -ENFILE;
> -
> - file = debugfs_create_regset32("regs", 0400, ctx->dir, regset);
> - if (!file) {
> - debugfs_remove(ctx->dir);
> - return -ENFILE;
> - }
>
> - file = debugfs_create_bool("coherent", 0400, ctx->dir,
> - &drvdata->coherent);
> -
> - if (!file) {
> - debugfs_remove_recursive(ctx->dir);
> - return -ENFILE;
> - }
> + debugfs_create_regset32("regs", 0400, ctx->dir, regset);
> + debugfs_create_bool("coherent", 0400, ctx->dir, &drvdata->coherent);
>
> drvdata->debugfs = ctx;
>
> diff --git a/drivers/crypto/ccree/cc_debugfs.h b/drivers/crypto/ccree/cc_debugfs.h
> index 5b5320eca7d2..01cbd9a95659 100644
> --- a/drivers/crypto/ccree/cc_debugfs.h
> +++ b/drivers/crypto/ccree/cc_debugfs.h
> @@ -5,7 +5,7 @@
> #define __CC_DEBUGFS_H__
>
> #ifdef CONFIG_DEBUG_FS
> -int cc_debugfs_global_init(void);
> +void cc_debugfs_global_init(void);
> void cc_debugfs_global_fini(void);
>
> int cc_debugfs_init(struct cc_drvdata *drvdata);
> @@ -13,11 +13,7 @@ void cc_debugfs_fini(struct cc_drvdata *drvdata);
>
> #else
>
> -static inline int cc_debugfs_global_init(void)
> -{
> - return 0;
> -}
> -
> +static inline void cc_debugfs_global_init(void) {}
> static inline void cc_debugfs_global_fini(void) {}
>
> static inline int cc_debugfs_init(struct cc_drvdata *drvdata)
> diff --git a/drivers/crypto/ccree/cc_driver.c b/drivers/crypto/ccree/cc_driver.c
> index 8ada308d72ee..662738e53ced 100644
> --- a/drivers/crypto/ccree/cc_driver.c
> +++ b/drivers/crypto/ccree/cc_driver.c
> @@ -538,13 +538,8 @@ static struct platform_driver ccree_driver = {
>
> static int __init ccree_init(void)
> {
> - int ret;
> -
> cc_hash_global_init();
> -
> - ret = cc_debugfs_global_init();
> - if (ret)
> - return ret;
> + cc_debugfs_global_init();
>
> return platform_driver_register(&ccree_driver);
> }
> --
> 2.20.1
>
--
Gilad Ben-Yossef
Chief Coffee Drinker
values of β will give rise to dom!
On Tue, Jan 22, 2019 at 04:14:19PM +0100, Greg Kroah-Hartman wrote:
> When calling debugfs functions, there is no need to ever check the
> return value. The function can work or not, but the code logic should
> never do something different based on this.
>
> Cc: Herbert Xu <[email protected]>
> Cc: "David S. Miller" <[email protected]>
> Cc: Robert Richter <[email protected]>
> Cc: Jan Glauber <[email protected]>
> Cc: [email protected]
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
> drivers/crypto/cavium/zip/zip_main.c | 52 ++++++----------------------
> 1 file changed, 11 insertions(+), 41 deletions(-)
Reviewed-by: Jan Glauber <[email protected]>
thanks,
Jan
On Wed, Jan 23, 2019 at 02:58:22PM +0200, Gilad Ben-Yossef wrote:
> Hi,
>
> On Tue, Jan 22, 2019 at 5:14 PM Greg Kroah-Hartman
> <[email protected]> wrote:
> >
> > When calling debugfs functions, there is no need to ever check the
> > return value. The function can work or not, but the code logic should
> > never do something different based on this.
>
>
>
> I get the part about not failing loading the driver just because some
> debugs entry isn't available, but wont it be weird if
> debugfs_create_dir() fails but debugfs_create_regset32() succeeds and
> we suddenly have weird files in the debugfs root dir?
> Not the end of the world of course but maybe it's better to avoid
> trying to create the files if the directory is not available?
See this patch to handle that theoretical issue:
https://lore.kernel.org/lkml/[email protected]/T/#me91cc3d16185be13d64f85c8477c543cbda9baf6
thanks,
greg k-h
On Wed, Jan 23, 2019 at 3:37 PM Greg Kroah-Hartman
<[email protected]> wrote:
>
> On Wed, Jan 23, 2019 at 02:58:22PM +0200, Gilad Ben-Yossef wrote:
> > Hi,
> >
> > On Tue, Jan 22, 2019 at 5:14 PM Greg Kroah-Hartman
> > <[email protected]> wrote:
> > >
> > > When calling debugfs functions, there is no need to ever check the
> > > return value. The function can work or not, but the code logic should
> > > never do something different based on this.
> >
> >
> >
> > I get the part about not failing loading the driver just because some
> > debugs entry isn't available, but wont it be weird if
> > debugfs_create_dir() fails but debugfs_create_regset32() succeeds and
> > we suddenly have weird files in the debugfs root dir?
> > Not the end of the world of course but maybe it's better to avoid
> > trying to create the files if the directory is not available?
>
> See this patch to handle that theoretical issue:
>
> https://lore.kernel.org/lkml/[email protected]/T/#me91cc3d16185be13d64f85c8477c543cbda9baf6
>
Ah, sorry. I've missed that.
Acked-By: Gilad Ben-Yossef <[email protected]>
Thanks!
Gilad
--
Gilad Ben-Yossef
Chief Coffee Drinker
values of β will give rise to dom!
On Tue, Jan 22, 2019 at 04:14:15PM +0100, Greg Kroah-Hartman wrote:
> When calling debugfs code, there is no need to ever check the return
> value of the call, as no logic should ever change if a call works
> properly or not. Fix up a bunch of crypto-specific code to not care
> about the results of debugfs.
>
> Greg Kroah-Hartman (7):
> crypto: qat: no need to check return value of debugfs_create functions
> crypto: ccrree: no need to check return value of debugfs_create
> functions
> crypto: axis: no need to check return value of debugfs_create
> functions
> crypto: cavium: zip: no need to check return value of debugfs_create
> functions
> crypto: cavium: nitrox: no need to check return value of
> debugfs_create functions
> crypto: ccp: no need to check return value of debugfs_create functions
> crypto: caam: no need to check return value of debugfs_create
> functions
>
> drivers/crypto/axis/artpec6_crypto.c | 9 ----
> drivers/crypto/caam/ctrl.c | 21 +++-----
> drivers/crypto/caam/intern.h | 1 -
> drivers/crypto/cavium/nitrox/nitrox_debugfs.c | 27 ++--------
> drivers/crypto/cavium/nitrox/nitrox_debugfs.h | 5 +-
> drivers/crypto/cavium/nitrox/nitrox_main.c | 4 +-
> drivers/crypto/cavium/zip/zip_main.c | 52 ++++---------------
> drivers/crypto/ccp/ccp-debugfs.c | 36 +++----------
> drivers/crypto/ccree/cc_debugfs.c | 22 ++------
> drivers/crypto/ccree/cc_debugfs.h | 8 +--
> drivers/crypto/ccree/cc_driver.c | 7 +--
> drivers/crypto/qat/qat_c3xxx/adf_drv.c | 5 --
> drivers/crypto/qat/qat_c3xxxvf/adf_drv.c | 5 --
> drivers/crypto/qat/qat_c62x/adf_drv.c | 5 --
> drivers/crypto/qat/qat_c62xvf/adf_drv.c | 5 --
> drivers/crypto/qat/qat_common/adf_cfg.c | 7 ---
> drivers/crypto/qat/qat_common/adf_transport.c | 6 ---
> .../qat/qat_common/adf_transport_debug.c | 15 ------
> drivers/crypto/qat/qat_dh895xcc/adf_drv.c | 5 --
> drivers/crypto/qat/qat_dh895xccvf/adf_drv.c | 5 --
> 20 files changed, 38 insertions(+), 212 deletions(-)
All applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt