diff mbox

[3/4] crypto-ixp4xx: Reduce assignment for a variable in init_ixp_crypto()

Message ID 5648D466.10307@users.sourceforge.net (mailing list archive)
State Rejected
Delegated to: Herbert Xu
Headers show

Commit Message

SF Markus Elfring Nov. 15, 2015, 6:52 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 15 Nov 2015 19:06:44 +0100

The variable "ret" was set more often than necessary by the
init_ixp_crypto() function.

* Omit its initialisation at the beginning.

* Use an error return code in two cases directly.

* Improve compliance with the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/crypto/ixp4xx_crypto.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Herbert Xu Nov. 17, 2015, 1:48 p.m. UTC | #1
On Sun, Nov 15, 2015 at 07:52:22PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 15 Nov 2015 19:06:44 +0100
> 
> The variable "ret" was set more often than necessary by the
> init_ixp_crypto() function.
> 
> * Omit its initialisation at the beginning.
> 
> * Use an error return code in two cases directly.
> 
> * Improve compliance with the Linux coding style convention.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Again I don't see how this is making the code better so nack.
diff mbox

Patch

diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index efe0eca..97da36a 100644
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -433,17 +433,17 @@  static void crypto_done_action(unsigned long arg)
 
 static int init_ixp_crypto(struct device *dev)
 {
-	int ret = -ENODEV;
+	int ret;
 	u32 msg[2] = { 0, 0 };
 
 	if (! ( ~(*IXP4XX_EXP_CFG2) & (IXP4XX_FEATURE_HASH |
 				IXP4XX_FEATURE_AES | IXP4XX_FEATURE_DES))) {
 		printk(KERN_ERR "ixp_crypto: No HW crypto available\n");
-		return ret;
+		return -ENODEV;
 	}
 	npe_c = npe_request(NPE_ID);
 	if (!npe_c)
-		return ret;
+		return -ENODEV;
 
 	if (!npe_running(npe_c)) {
 		ret = npe_load_firmware(npe_c, npe_name(npe_c), dev);
@@ -481,13 +481,14 @@  static int init_ixp_crypto(struct device *dev)
 	BUILD_BUG_ON(SHA1_DIGEST_SIZE > sizeof(struct buffer_desc));
 	buffer_pool = dma_pool_create("buffer", dev,
 			sizeof(struct buffer_desc), 32, 0);
-	ret = -ENOMEM;
 	if (!buffer_pool) {
+		ret = -ENOMEM;
 		goto err;
 	}
 	ctx_pool = dma_pool_create("context", dev,
 			NPE_CTX_LEN, 16, 0);
 	if (!ctx_pool) {
+		ret = -ENOMEM;
 		goto err;
 	}
 	ret = qmgr_request_queue(SEND_QID, NPE_QLEN_TOTAL, 0, 0,