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

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 2015-11-15 20:00 +0100
Message-ID <qvaGS-55G-15@gated-at.bofh.it> (permalink)
References (13 earlier) <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>
Organization linux.* mail to news gateway

Show all headers | 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 | NextPrevious 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