Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1269744 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2015-11-15 19:50 +0100 |
| Last post | 2015-11-18 08:30 +0100 |
| Articles | 14 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[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
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-15 19:50 +0100 |
| Subject | [PATCH 0/4] crypto-ixp4xx: Deletion of a few unnecessary checks |
| Message-ID | <qvaxb-526-7@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Sun, 15 Nov 2015 19:39:00 +0100 Further update suggestions were taken into account after a patch was applied from static source code analysis. Markus Elfring (4): Delete unnecessary checks before the function call "dma_pool_destroy" Two function calls less in init_ixp_crypto() after error detection Reduce assignment for a variable in init_ixp_crypto() Less function calls in init_ixp_crypto() after error detection drivers/crypto/ixp4xx_crypto.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) -- 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/
[toc] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-15 20:00 +0100 |
| Subject | [PATCH 2/4] crypto-ixp4xx: Two function calls less in init_ixp_crypto() after error detection |
| Message-ID | <qvaGR-55G-1@gated-at.bofh.it> |
| In reply to | #1269744 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Sun, 15 Nov 2015 18:28:39 +0100 The dma_pool_destroy() function was called twice with a null pointer if a "npe_error" was reported. This implementation detail could be improved by the introduction of another jump label. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/crypto/ixp4xx_crypto.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index e52496a..efe0eca 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c @@ -509,9 +509,11 @@ static int init_ixp_crypto(struct device *dev) npe_error: printk(KERN_ERR "%s not responding\n", npe_name(npe_c)); ret = -EIO; + goto release_npe; err: dma_pool_destroy(ctx_pool); dma_pool_destroy(buffer_pool); +release_npe: npe_release(npe_c); return ret; } -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Herbert Xu <herbert@gondor.apana.org.au> |
|---|---|
| Date | 2015-11-17 14:50 +0100 |
| Subject | Re: [PATCH 2/4] crypto-ixp4xx: Two function calls less in init_ixp_crypto() after error detection |
| Message-ID | <qvONY-5HC-19@gated-at.bofh.it> |
| In reply to | #1269748 |
On Sun, Nov 15, 2015 at 07:50:51PM +0100, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sun, 15 Nov 2015 18:28:39 +0100 > > The dma_pool_destroy() function was called twice with a null pointer > if a "npe_error" was reported. > > This implementation detail could be improved by the introduction > of another jump label. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > drivers/crypto/ixp4xx_crypto.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c > index e52496a..efe0eca 100644 > --- a/drivers/crypto/ixp4xx_crypto.c > +++ b/drivers/crypto/ixp4xx_crypto.c > @@ -509,9 +509,11 @@ static int init_ixp_crypto(struct device *dev) > npe_error: > printk(KERN_ERR "%s not responding\n", npe_name(npe_c)); > ret = -EIO; > + goto release_npe; > err: > dma_pool_destroy(ctx_pool); > dma_pool_destroy(buffer_pool); > +release_npe: > npe_release(npe_c); > return ret; I think this patch is making the code worse so I'm not applying it. -- Email: Herbert Xu <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- 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/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-15 20:00 +0100 |
| Subject | [PATCH 4/4] crypto-ixp4xx: Less function calls in init_ixp_crypto() after error detection |
| Message-ID | <qvaGS-55G-15@gated-at.bofh.it> |
| In reply to | #1269744 |
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/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-15 20:00 +0100 |
| Subject | [PATCH 3/4] crypto-ixp4xx: Reduce assignment for a variable in init_ixp_crypto() |
| Message-ID | <qvaGS-55G-17@gated-at.bofh.it> |
| In reply to | #1269744 |
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/
[toc] | [prev] | [next] | [standalone]
| From | Herbert Xu <herbert@gondor.apana.org.au> |
|---|---|
| Date | 2015-11-17 14:50 +0100 |
| Subject | Re: [PATCH 3/4] crypto-ixp4xx: Reduce assignment for a variable in init_ixp_crypto() |
| Message-ID | <qvONX-5HC-1@gated-at.bofh.it> |
| In reply to | #1269750 |
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. -- Email: Herbert Xu <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- 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/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-15 20:00 +0100 |
| Subject | [PATCH 1/4] crypto-ixp4xx: Delete unnecessary checks before the function call "dma_pool_destroy" |
| Message-ID | <qvaGS-55G-19@gated-at.bofh.it> |
| In reply to | #1269744 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Sun, 15 Nov 2015 16:51:21 +0100 The dma_pool_destroy() function tests whether its argument is NULL and then returns immediately. Thus the test around the calls is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/crypto/ixp4xx_crypto.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 8f27903..e52496a 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c @@ -510,10 +510,8 @@ npe_error: printk(KERN_ERR "%s not responding\n", npe_name(npe_c)); ret = -EIO; err: - if (ctx_pool) - dma_pool_destroy(ctx_pool); - if (buffer_pool) - dma_pool_destroy(buffer_pool); + dma_pool_destroy(ctx_pool); + dma_pool_destroy(buffer_pool); npe_release(npe_c); return ret; } -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Herbert Xu <herbert@gondor.apana.org.au> |
|---|---|
| Date | 2015-11-17 15:20 +0100 |
| Subject | Re: [PATCH 1/4] crypto-ixp4xx: Delete unnecessary checks before the function call "dma_pool_destroy" |
| Message-ID | <qvPh1-67E-17@gated-at.bofh.it> |
| In reply to | #1269751 |
On Sun, Nov 15, 2015 at 07:49:16PM +0100, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sun, 15 Nov 2015 16:51:21 +0100 > > The dma_pool_destroy() function tests whether its argument is NULL > and then returns immediately. Thus the test around the calls is not needed. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Patch applied. Thanks. -- Email: Herbert Xu <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- 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/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-17 16:40 +0100 |
| Subject | [PATCH v2 0/3] crypto-ixp4xx: Deletion of a few unnecessary checks |
| Message-ID | <qvQwr-6RR-45@gated-at.bofh.it> |
| In reply to | #1269744 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 17 Nov 2015 16:26:01 +0100 Subject: [PATCH 0/3] crypto-ixp4xx: Deletion of a few unnecessary checks Further update suggestions were taken into account after a patch was applied from static source code analysis. Markus Elfring (3): Delete unnecessary checks before the function call "dma_pool_destroy" Reduce assignment for a variable in init_ixp_crypto() crypto-ixp4xx: Less function calls in init_ixp_crypto() after error detection drivers/crypto/ixp4xx_crypto.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) -- 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/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-17 16:50 +0100 |
| Subject | [PATCH v2 2/3] crypto-ixp4xx: Reduce assignment for a variable in init_ixp_crypto() |
| Message-ID | <qvQG5-6Vs-13@gated-at.bofh.it> |
| In reply to | #1271338 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Nov 2015 15:45:32 +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 e52496a..79b6958 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/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-17 16:50 +0100 |
| Subject | [PATCH v2 3/3] crypto-ixp4xx: Less function calls in init_ixp_crypto() after error detection |
| Message-ID | <qvQG6-6Vs-29@gated-at.bofh.it> |
| In reply to | #1271338 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Nov 2015 16:15:21 +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 | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index 79b6958..0a5969c 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);
@@ -510,9 +510,11 @@ static int init_ixp_crypto(struct device *dev)
npe_error:
printk(KERN_ERR "%s not responding\n", npe_name(npe_c));
ret = -EIO;
-err:
+destroy_ctx_pool:
dma_pool_destroy(ctx_pool);
+destroy_buffer_pool:
dma_pool_destroy(buffer_pool);
+release_npe:
npe_release(npe_c);
return ret;
}
--
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/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-17 16:50 +0100 |
| Subject | [PATCH v2 1/3] crypto-ixp4xx: Delete unnecessary checks before the function call "dma_pool_destroy" |
| Message-ID | <qvQG6-6Vs-35@gated-at.bofh.it> |
| In reply to | #1271338 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Sun, 15 Nov 2015 16:51:21 +0100 The dma_pool_destroy() function tests whether its argument is NULL and then returns immediately. Thus the test around the calls is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/crypto/ixp4xx_crypto.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 8f27903..e52496a 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c @@ -510,10 +510,8 @@ npe_error: printk(KERN_ERR "%s not responding\n", npe_name(npe_c)); ret = -EIO; err: - if (ctx_pool) - dma_pool_destroy(ctx_pool); - if (buffer_pool) - dma_pool_destroy(buffer_pool); + dma_pool_destroy(ctx_pool); + dma_pool_destroy(buffer_pool); npe_release(npe_c); return ret; } -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Herbert Xu <herbert@gondor.apana.org.au> |
|---|---|
| Date | 2015-11-18 01:10 +0100 |
| Subject | Re: [PATCH v2 0/3] crypto-ixp4xx: Deletion of a few unnecessary checks |
| Message-ID | <qvYtY-3GN-11@gated-at.bofh.it> |
| In reply to | #1271338 |
On Tue, Nov 17, 2015 at 04:32:47PM +0100, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Tue, 17 Nov 2015 16:26:01 +0100 > Subject: [PATCH 0/3] crypto-ixp4xx: Deletion of a few unnecessary checks > > Further update suggestions were taken into account after a patch > was applied from static source code analysis. > > Markus Elfring (3): > Delete unnecessary checks before the function call "dma_pool_destroy" > Reduce assignment for a variable in init_ixp_crypto() > crypto-ixp4xx: Less function calls in init_ixp_crypto() after error detection You completely ignored my comments. Nack. -- Email: Herbert Xu <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- 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/
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2015-11-18 08:30 +0100 |
| Subject | Re: crypto-ixp4xx: Deletion of a few unnecessary checks |
| Message-ID | <qw5lL-8cX-7@gated-at.bofh.it> |
| In reply to | #1271753 |
>> Delete unnecessary checks before the function call "dma_pool_destroy" It seems that you accepted this specific update suggestion, didn't you? https://lkml.org/lkml/2015/11/17/391 https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1021951.html >> Reduce assignment for a variable in init_ixp_crypto() >> crypto-ixp4xx: Less function calls in init_ixp_crypto() after error detection > > You completely ignored my comments. Nack. Will it be useful to clarify the proposed changes a bit more? Regards, Markus -- 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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web