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


Groups > linux.kernel > #1269749

[PATCH 4/4] crypto-ixp4xx: Less function calls in init_ixp_crypto() after error detection

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 4/4] crypto-ixp4xx: Less function calls in init_ixp_crypto() after error detection
Date Sun, 15 Nov 2015 20:00:02 +0100
Message-ID <qvaGS-55G-15@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:3jUgxcw+fZhNv3BTMbgSzqQT0kds6nHNGI9pWTFGs1SrJU861AG hRoXWBeKheDjfYAE7Ha6OotaxLlzeRteYpwypt2rVMIfIEsJrVAF+OrYWnYdA90dl30rLBR 2sKeCihj+WqYUKdug4PNnX1RDB3cNa9Ccs3+qlAxEY7DHNlh7BRBe3Ko+NEBPfPt4e6flO0 /8nfQKY3TGBQrZ+nvJorg==
X-Ui-Out-Filterresults notjunk:1;V01:K0:mIz5cG2efkw=:AXOCIeTpJiRctFcnHMPeHy xSVNtZARdSG6fQ82ZMXIRliGe8Z3/CemSroMfLeJudp3ahPqTgvVWUrYmGBLXrq3dVrruDIaU pb1w9QKC4nYJExfXw2cOw7TWBQoghlLbYhBO7ugbJdb4kZ1ul0XTq2aMYiMjOw0jOSQiEmcBh 5f1wYp6Nc5itPASQ9x2U3SGeCFr48U+s9E69RiMUEPbXroRszn8dBKalQdacrBl+5ZiKLFOG1 YxPYui4VpY7DuPg7+6jPhrgwvoM5k6FeKB1kZFThmi6rbwMzPHNf4B9wNzUvxT7mmN+FtglmF eABTJ65sTu3SkA1D3M10UNJd7l7GsXEvd/ABmJyh2yyfIpgY9SLyd6aCnpKSbeWUhT0Nf3UKU zG1kEqvWvqIxJ7gtA0oyWqLlH4GM9ouGMMxODZ9FIUU8OxE9c4AfmX3Nm1pcCKfmXwlbOHFkI CrsG6IJZEnD7PEKmKvAjNgFVKF7fvz6Cf1tAAjr5r26eSY2fycWBr4QJq7sdlXbLDMcEVelkZ NpsGjqTNTN0Z4B/aiIn9qEb3ukzUB7cGDXczoQqz2Mkdu8rqBOazT1Mb9LIuObDDiX7pfW7jN kRNL4okq67A9YnxNs2QVWqGQWSAsYaLwyuPzkcI59xkaXvh/bIyYzM1JnOSQwGLKiCUBoRKOZ 0Ac5+7+mDmYeaEPuvEp6gBhDXpqPgROgwbiKxX3EE08I9pssCVjEqo7A9ysuAtmBznHn+Mwzd tszR8eepJMKAn5C1Xdb7nG24B26vtXyFgBNVXGlFYHYffVRn743qtQPVA/9PO09CfOmY5bB5n Yzw9aK+
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:54:10 +0100
X-Original-Message-ID <5648D4D2.4080008@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:1269749

Show key headers only | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 15 Nov 2015 19:23:55 +0100

The dma_pool_destroy() function was called in up to two cases by the
init_ixp_crypto() function during error handling even if a call of
the dma_pool_create() function failed.

This implementation detail could be improved by the adjustment
of jump targets according to the Linux coding style convention.

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

diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index 97da36a..a2c3155 100644
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -483,23 +483,23 @@ static int init_ixp_crypto(struct device *dev)
 			sizeof(struct buffer_desc), 32, 0);
 	if (!buffer_pool) {
 		ret = -ENOMEM;
-		goto err;
+		goto release_npe;
 	}
 	ctx_pool = dma_pool_create("context", dev,
 			NPE_CTX_LEN, 16, 0);
 	if (!ctx_pool) {
 		ret = -ENOMEM;
-		goto err;
+		goto destroy_buffer_pool;
 	}
 	ret = qmgr_request_queue(SEND_QID, NPE_QLEN_TOTAL, 0, 0,
 				 "ixp_crypto:out", NULL);
 	if (ret)
-		goto err;
+		goto destroy_ctx_pool;
 	ret = qmgr_request_queue(RECV_QID, NPE_QLEN, 0, 0,
 				 "ixp_crypto:in", NULL);
 	if (ret) {
 		qmgr_release_queue(SEND_QID);
-		goto err;
+		goto destroy_ctx_pool;
 	}
 	qmgr_set_irq(RECV_QID, QUEUE_IRQ_SRC_NOT_EMPTY, irqhandler, NULL);
 	tasklet_init(&crypto_done_tasklet, crypto_done_action, 0);
@@ -511,8 +511,9 @@ npe_error:
 	printk(KERN_ERR "%s not responding\n", npe_name(npe_c));
 	ret = -EIO;
 	goto release_npe;
-err:
+destroy_ctx_pool:
 	dma_pool_destroy(ctx_pool);
+destroy_buffer_pool:
 	dma_pool_destroy(buffer_pool);
 release_npe:
 	npe_release(npe_c);
-- 
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