crypto: nx: no need to check return value of debugfs_create functions
Subsystems (3)
PATCH 1/1 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.
--- drivers/crypto/nx/nx.c | 4 +- drivers/crypto/nx/nx.h | 12 +----- drivers/crypto/nx/nx_debugfs.c | 71 +++++++++++----------------------- 3 files changed, 26 insertions(+), 61 deletions(-)
drivers/crypto/nx/nx.c +1 -3
@@ -581,9 +581,7 @@ static int nx_register_algs(void)memset (&nx_driver.stats,0 ,sizeof (struct nx_stats )); - rc =NX_DEBUGFS_INIT (&nx_driver); -if (rc) - goto out; +NX_DEBUGFS_INIT (&nx_driver); nx_driver.of.status =NX_OKAY ;
drivers/crypto/nx/nx.h +2 -10
@@ -76,20 +76,12 @@ struct nx_stats {atomic_t last_error_pid; }; -struct nx_debugfs { -struct dentry *dfs_root; -struct dentry *dfs_aes_ops, *dfs_aes_bytes; -struct dentry *dfs_sha256_ops, *dfs_sha256_bytes; -struct dentry *dfs_sha512_ops, *dfs_sha512_bytes; -struct dentry *dfs_errors, *dfs_last_error, *dfs_last_error_pid; -}; -struct nx_crypto_driver {struct nx_stats stats;struct nx_of of;struct vio_dev *viodev;struct vio_driver viodriver; -struct nx_debugfs dfs; +struct dentry *dfs_root; };#define NX_GCM4106_NONCE_LEN (4)
@@ -177,7 +169,7 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned int,#define NX_DEBUGFS_INIT (drv) nx_debugfs_init(drv)#define NX_DEBUGFS_FINI (drv) nx_debugfs_fini(drv) -int nx_debugfs_init (struct nx_crypto_driver *); +void nx_debugfs_init (struct nx_crypto_driver *);void nx_debugfs_fini (struct nx_crypto_driver *);#else #define NX_DEBUGFS_INIT (drv) (0)
drivers/crypto/nx/nx_debugfs.c +23 -48
85 lines not on this page · raw message
Signature · 1 line
2.22.0
PATCH v2 1/1 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.
---
v2: fixed build error found by kbuild
drivers/crypto/nx/nx.c | 4 +- drivers/crypto/nx/nx.h | 12 +----- drivers/crypto/nx/nx_debugfs.c | 71 +++++++++++----------------------- 3 files changed, 26 insertions(+), 61 deletions(-)
drivers/crypto/nx/nx.c +1 -3
@@ -581,9 +581,7 @@ static int nx_register_algs(void)memset (&nx_driver.stats,0 ,sizeof (struct nx_stats )); - rc =NX_DEBUGFS_INIT (&nx_driver); -if (rc) - goto out; +NX_DEBUGFS_INIT (&nx_driver); nx_driver.of.status =NX_OKAY ;
drivers/crypto/nx/nx.h +2 -10
@@ -76,20 +76,12 @@ struct nx_stats {atomic_t last_error_pid; }; -struct nx_debugfs { -struct dentry *dfs_root; -struct dentry *dfs_aes_ops, *dfs_aes_bytes; -struct dentry *dfs_sha256_ops, *dfs_sha256_bytes; -struct dentry *dfs_sha512_ops, *dfs_sha512_bytes; -struct dentry *dfs_errors, *dfs_last_error, *dfs_last_error_pid; -}; -struct nx_crypto_driver {struct nx_stats stats;struct nx_of of;struct vio_dev *viodev;struct vio_driver viodriver; -struct nx_debugfs dfs; +struct dentry *dfs_root; };#define NX_GCM4106_NONCE_LEN (4)
@@ -177,7 +169,7 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned int,#define NX_DEBUGFS_INIT (drv) nx_debugfs_init(drv)#define NX_DEBUGFS_FINI (drv) nx_debugfs_fini(drv) -int nx_debugfs_init (struct nx_crypto_driver *); +void nx_debugfs_init (struct nx_crypto_driver *);void nx_debugfs_fini (struct nx_crypto_driver *);#else #define NX_DEBUGFS_INIT (drv) (0)
drivers/crypto/nx/nx_debugfs.c +23 -48
85 lines not on this page · raw message
Signature · 1 line
2.22.0
Herbert Xu
maintainerQuoted 19 lines · Greg Kroah-Hartman
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" <[email protected]>Cc Nayna Jain <[email protected]>Cc Paulo Flabiano Smorigo <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Michael Ellerman <[email protected]>Cc Herbert Xu <[email protected]>Cc "David S. Miller" <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 7 lines
---
v2: fixed build error found by kbuilddrivers/crypto/nx/nx.c | 4 +- drivers/crypto/nx/nx.h | 12 +----- drivers/crypto/nx/nx_debugfs.c | 71 +++++++++++----------------------- 3 files changed, 26 insertions(+), 61 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt