summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-14 10:29:04 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2019-06-20 02:19:55 -0400
commit576d152ccc56574475faa7460d4b507e8440e9aa (patch)
tree7b5f47e82b2808f0677f56062f88d5e6f27ca2ef
parent97a5fee2bd70df9e48cdfdbbacc15d45089228a3 (diff)
crypto: nx - no need to check return value of debugfs_create functions
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. Also, there is no need to store the individual debugfs file names, especially as the whole directiry is deleted at once, so remove the unneeded structure entirely. Cc: "Breno Leitão" <leitao@debian.org> Cc: Nayna Jain <nayna@linux.ibm.com> Cc: Paulo Flabiano Smorigo <pfsmorigo@gmail.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: "David S. Miller" <davem@davemloft.net> Cc: linux-crypto@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/nx/nx.c4
-rw-r--r--drivers/crypto/nx/nx.h12
-rw-r--r--drivers/crypto/nx/nx_debugfs.c71
3 files changed, 26 insertions, 61 deletions
diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c
index 3a5e31be4764..20b5e276f184 100644
--- a/drivers/crypto/nx/nx.c
+++ b/drivers/crypto/nx/nx.c
@@ -581,9 +581,7 @@ static int nx_register_algs(void)
581 581
582 memset(&nx_driver.stats, 0, sizeof(struct nx_stats)); 582 memset(&nx_driver.stats, 0, sizeof(struct nx_stats));
583 583
584 rc = NX_DEBUGFS_INIT(&nx_driver); 584 NX_DEBUGFS_INIT(&nx_driver);
585 if (rc)
586 goto out;
587 585
588 nx_driver.of.status = NX_OKAY; 586 nx_driver.of.status = NX_OKAY;
589 587
diff --git a/drivers/crypto/nx/nx.h b/drivers/crypto/nx/nx.h
index c3e54af18645..c6b5a3be02be 100644
--- a/drivers/crypto/nx/nx.h
+++ b/drivers/crypto/nx/nx.h
@@ -76,20 +76,12 @@ struct nx_stats {
76 atomic_t last_error_pid; 76 atomic_t last_error_pid;
77}; 77};
78 78
79struct nx_debugfs {
80 struct dentry *dfs_root;
81 struct dentry *dfs_aes_ops, *dfs_aes_bytes;
82 struct dentry *dfs_sha256_ops, *dfs_sha256_bytes;
83 struct dentry *dfs_sha512_ops, *dfs_sha512_bytes;
84 struct dentry *dfs_errors, *dfs_last_error, *dfs_last_error_pid;
85};
86
87struct nx_crypto_driver { 79struct nx_crypto_driver {
88 struct nx_stats stats; 80 struct nx_stats stats;
89 struct nx_of of; 81 struct nx_of of;
90 struct vio_dev *viodev; 82 struct vio_dev *viodev;
91 struct vio_driver viodriver; 83 struct vio_driver viodriver;
92 struct nx_debugfs dfs; 84 struct dentry *dfs_root;
93}; 85};
94 86
95#define NX_GCM4106_NONCE_LEN (4) 87#define NX_GCM4106_NONCE_LEN (4)
@@ -177,7 +169,7 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned int,
177#define NX_DEBUGFS_INIT(drv) nx_debugfs_init(drv) 169#define NX_DEBUGFS_INIT(drv) nx_debugfs_init(drv)
178#define NX_DEBUGFS_FINI(drv) nx_debugfs_fini(drv) 170#define NX_DEBUGFS_FINI(drv) nx_debugfs_fini(drv)
179 171
180int nx_debugfs_init(struct nx_crypto_driver *); 172void nx_debugfs_init(struct nx_crypto_driver *);
181void nx_debugfs_fini(struct nx_crypto_driver *); 173void nx_debugfs_fini(struct nx_crypto_driver *);
182#else 174#else
183#define NX_DEBUGFS_INIT(drv) (0) 175#define NX_DEBUGFS_INIT(drv) (0)
diff --git a/drivers/crypto/nx/nx_debugfs.c b/drivers/crypto/nx/nx_debugfs.c
index 7ab2e8dcd9b4..add1d8d0d23c 100644
--- a/drivers/crypto/nx/nx_debugfs.c
+++ b/drivers/crypto/nx/nx_debugfs.c
@@ -42,62 +42,37 @@
42 * Documentation/ABI/testing/debugfs-pfo-nx-crypto 42 * Documentation/ABI/testing/debugfs-pfo-nx-crypto
43 */ 43 */
44 44
45int nx_debugfs_init(struct nx_crypto_driver *drv) 45void nx_debugfs_init(struct nx_crypto_driver *drv)
46{ 46{
47 struct nx_debugfs *dfs = &drv->dfs; 47 struct dentry *root;
48 48
49 dfs->dfs_root = debugfs_create_dir(NX_NAME, NULL); 49 root = debugfs_create_dir(NX_NAME, NULL);
50 drv->dfs_root = root;
50 51
51 dfs->dfs_aes_ops = 52 debugfs_create_u32("aes_ops", S_IRUSR | S_IRGRP | S_IROTH,
52 debugfs_create_u32("aes_ops", 53 root, (u32 *)&drv->stats.aes_ops);
53 S_IRUSR | S_IRGRP | S_IROTH, 54 debugfs_create_u32("sha256_ops", S_IRUSR | S_IRGRP | S_IROTH,
54 dfs->dfs_root, (u32 *)&drv->stats.aes_ops); 55 root, (u32 *)&drv->stats.sha256_ops);
55 dfs->dfs_sha256_ops = 56 debugfs_create_u32("sha512_ops", S_IRUSR | S_IRGRP | S_IROTH,
56 debugfs_create_u32("sha256_ops", 57 root, (u32 *)&drv->stats.sha512_ops);
57 S_IRUSR | S_IRGRP | S_IROTH, 58 debugfs_create_u64("aes_bytes", S_IRUSR | S_IRGRP | S_IROTH,
58 dfs->dfs_root, 59 root, (u64 *)&drv->stats.aes_bytes);
59 (u32 *)&drv->stats.sha256_ops); 60 debugfs_create_u64("sha256_bytes", S_IRUSR | S_IRGRP | S_IROTH,
60 dfs->dfs_sha512_ops = 61 root, (u64 *)&drv->stats.sha256_bytes);
61 debugfs_create_u32("sha512_ops", 62 debugfs_create_u64("sha512_bytes", S_IRUSR | S_IRGRP | S_IROTH,
62 S_IRUSR | S_IRGRP | S_IROTH, 63 root, (u64 *)&drv->stats.sha512_bytes);
63 dfs->dfs_root, 64 debugfs_create_u32("errors", S_IRUSR | S_IRGRP | S_IROTH,
64 (u32 *)&drv->stats.sha512_ops); 65 root, (u32 *)&drv->stats.errors);
65 dfs->dfs_aes_bytes = 66 debugfs_create_u32("last_error", S_IRUSR | S_IRGRP | S_IROTH,
66 debugfs_create_u64("aes_bytes", 67 root, (u32 *)&drv->stats.last_error);
67 S_IRUSR | S_IRGRP | S_IROTH, 68 debugfs_create_u32("last_error_pid", S_IRUSR | S_IRGRP | S_IROTH,
68 dfs->dfs_root, 69 root, (u32 *)&drv->stats.last_error_pid);
69 (u64 *)&drv->stats.aes_bytes);
70 dfs->dfs_sha256_bytes =
71 debugfs_create_u64("sha256_bytes",
72 S_IRUSR | S_IRGRP | S_IROTH,
73 dfs->dfs_root,
74 (u64 *)&drv->stats.sha256_bytes);
75 dfs->dfs_sha512_bytes =
76 debugfs_create_u64("sha512_bytes",
77 S_IRUSR | S_IRGRP | S_IROTH,
78 dfs->dfs_root,
79 (u64 *)&drv->stats.sha512_bytes);
80 dfs->dfs_errors =
81 debugfs_create_u32("errors",
82 S_IRUSR | S_IRGRP | S_IROTH,
83 dfs->dfs_root, (u32 *)&drv->stats.errors);
84 dfs->dfs_last_error =
85 debugfs_create_u32("last_error",
86 S_IRUSR | S_IRGRP | S_IROTH,
87 dfs->dfs_root,
88 (u32 *)&drv->stats.last_error);
89 dfs->dfs_last_error_pid =
90 debugfs_create_u32("last_error_pid",
91 S_IRUSR | S_IRGRP | S_IROTH,
92 dfs->dfs_root,
93 (u32 *)&drv->stats.last_error_pid);
94 return 0;
95} 70}
96 71
97void 72void
98nx_debugfs_fini(struct nx_crypto_driver *drv) 73nx_debugfs_fini(struct nx_crypto_driver *drv)
99{ 74{
100 debugfs_remove_recursive(drv->dfs.dfs_root); 75 debugfs_remove_recursive(drv->dfs_root);
101} 76}
102 77
103#endif 78#endif