Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1269750

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

Path csiph.com!goblin3!goblin.stu.neva.ru!sewer!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 3/4] crypto-ixp4xx: Reduce assignment for a variable in init_ixp_crypto()
Date Sun, 15 Nov 2015 20:00:02 +0100
Message-ID <qvaGS-55G-17@gated-at.bofh.it> (permalink)
References <mSsDN-4wa-35@gated-at.bofh.it> <mSsDN-4wa-37@gated-at.bofh.it> <mSsDN-4wa-39@gated-at.bofh.it> <mSsDN-4wa-41@gated-at.bofh.it> <mSsDN-4wa-43@gated-at.bofh.it> <mSsDN-4wa-45@gated-at.bofh.it> <mSsDN-4wa-47@gated-at.bofh.it> <mSsDN-4wa-49@gated-at.bofh.it> <mSsDN-4wa-51@gated-at.bofh.it> <mSsDN-4wa-53@gated-at.bofh.it> <mSsDN-4wa-55@gated-at.bofh.it> <mSsDN-4wa-57@gated-at.bofh.it> <mSsDN-4wa-59@gated-at.bofh.it> <mSsDN-4wa-61@gated-at.bofh.it> <mSsDN-4wa-63@gated-at.bofh.it> <mSsDN-4wa-65@gated-at.bofh.it> <mSsDN-4wa-33@gated-at.bofh.it> <qvaxb-526-7@gated-at.bofh.it>
X-Original-To "David S. Miller" <davem@davemloft.net>, Herbert Xu <herbert@gondor.apana.org.au>, linux-crypto@vger.kernel.org
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Provags-ID V03:K0:e9wqxtHRI/FE5ta2elfXqgkebGbDjGlvU0WeJCmg5xyLimpd7B9 +T4hjx188OEkWHoVB9Omy0GmCoocgz9mvvP2gqSHZX9zGRW+P85/Xbcy6Mm+lj2h3QvWv62 sBTVT6HJR/Abdgz2HLbMuSnR6xDIR7lNnBJdPAYI1a3uTRjNvjt0rYC1rBKI/QCFA0zQk/F /SWiXawCO5lm6WNiaAXgQ==
X-Ui-Out-Filterresults notjunk:1;V01:K0:C+dNks2/50A=:jNLGRiyz25jzrYCgbBLC5v wXNi2gmoyNMdhTPmDFUmb84FP5lzTQ1LDkMY/+0cAAkPoY94l/4KpjWOtIB6twawH+zpRJF1B 7DLfNio7FVoB2YPuRIyf1YxasicifCtQcRoV4XU79/hj5OR4UOO3OCgFwBDrYvQ2dLe/Fq33T 7Lg82l8fK599LCL75W5tmJduDm+M0k1D9ubFUC0i+1Xy917+zLN5HDPGYpCex7aKmTgPkgfsY pZyPw1h8Ry266OxsmPl/IqS9ifmqeCdp7ZYxPbmm46nFq4ShR3ab4Pkgh8OX/RVaChOePX6ID VgTbAoWtV/is1+sGr77OpkC/AQdMtr9S8Bu6jMMBCOg5JkdyGHYFy//gDA9yGP8PCsmz1mdz3 2yGxSiESqb3+PvowYvshkvpEYwMxLUbqr99M1AyD74qoOJwGIDXyhZ1JPZUCV/M49Cnn0SOP/ Cnc5lgc2gpriQ6k/Js6qUjh4+osMF9cmJxXs9bgd+azndCKnaHySd5gb7il8BbUYsqCEOkFgh yvGT4Fw3XzMzU39cwgBVCJeH1IMUSWO20ujf3S998lYYEV6RI4ammMcCObu9DewcRJjY2j0+b yRudIFFpjOo+utOLDbyQ0xlGLwJ+WSfZ7sJgBW1JoTFKDZBBSpAtOLAbCxsWZE3YZ9SH8aBLe tC8T0sm4XFBdKiwql2AtTlh8Q3KcRPbGfp8AHkWbOyk/+yCrBsvOqnQQzBJYHZPmv5U2xZxts Cjd8BYJsUhN2ubGHJiPvEfPtBj9WKoc2i2abYKclhyrxPtPZkjM2iTAZe9DXNEp6GzDcEO/Aa tnLavyo
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 66
Organization linux.* mail to news gateway
X-Original-Cc LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org, Julia Lawall <julia.lawall@lip6.fr>
X-Original-Date Sun, 15 Nov 2015 19:52:22 +0100
X-Original-Message-ID <5648D466.10307@users.sourceforge.net>
X-Original-References <5307CAA2.8060406@users.sourceforge.net> <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6> <530A086E.8010901@users.sourceforge.net> <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6> <530A72AA.3000601@users.sourceforge.net> <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6> <530B5FB6.6010207@users.sourceforge.net> <alpine.DEB.2.10.1402241710370.2074@hadrien> <530C5E18.1020800@users.sourceforge.net> <alpine.DEB.2.10.1402251014170.2080@hadrien> <530CD2C4.4050903@users.sourceforge.net> <alpine.DEB.2.10.1402251840450.7035@hadrien> <530CF8FF.8080600@users.sourceforge.net> <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6> <530DD06F.4090703@users.sourceforge.net> <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6> <5317A59D.4@users.sourceforge.net> <5648D2C1.8050603@users.sourceforge.net>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1269750

Show key headers only | View raw


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(-)

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,
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] crypto-ixp4xx: Deletion of a few unnecessary checks SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-15 19:50 +0100
  [PATCH 2/4] crypto-ixp4xx: Two function calls less in  init_ixp_crypto() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-15 20:00 +0100
    Re: [PATCH 2/4] crypto-ixp4xx: Two function calls less in  init_ixp_crypto() after error detection Herbert Xu <herbert@gondor.apana.org.au> - 2015-11-17 14:50 +0100
  [PATCH 4/4] crypto-ixp4xx: Less function calls in init_ixp_crypto()  after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-15 20:00 +0100
  [PATCH 3/4] crypto-ixp4xx: Reduce assignment for a variable in  init_ixp_crypto() SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-15 20:00 +0100
    Re: [PATCH 3/4] crypto-ixp4xx: Reduce assignment for a variable in  init_ixp_crypto() Herbert Xu <herbert@gondor.apana.org.au> - 2015-11-17 14:50 +0100
  [PATCH 1/4] crypto-ixp4xx: Delete unnecessary checks before the  function call "dma_pool_destroy" SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-15 20:00 +0100
    Re: [PATCH 1/4] crypto-ixp4xx: Delete unnecessary checks before the  function call "dma_pool_destroy" Herbert Xu <herbert@gondor.apana.org.au> - 2015-11-17 15:20 +0100
  [PATCH v2 0/3] crypto-ixp4xx: Deletion of a few unnecessary checks SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-17 16:40 +0100
    [PATCH v2 2/3] crypto-ixp4xx: Reduce assignment for a variable in  init_ixp_crypto() SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-17 16:50 +0100
    [PATCH v2 3/3] crypto-ixp4xx: Less function calls in  init_ixp_crypto() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-17 16:50 +0100
    [PATCH v2 1/3] crypto-ixp4xx: Delete unnecessary checks before the  function call "dma_pool_destroy" SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-17 16:50 +0100
    Re: [PATCH v2 0/3] crypto-ixp4xx: Deletion of a few unnecessary  checks Herbert Xu <herbert@gondor.apana.org.au> - 2015-11-18 01:10 +0100
      Re: crypto-ixp4xx: Deletion of a few unnecessary checks SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-18 08:30 +0100

csiph-web