diff options
author | Alex Porosanu <alexandru.porosanu@freescale.com> | 2014-05-12 15:25:12 (GMT) |
---|---|---|
committer | Jose Rivera <German.Rivera@freescale.com> | 2014-05-13 15:05:17 (GMT) |
commit | 58cf78891f63e68ccfd0f225ab64e7aedfca1999 (patch) | |
tree | 2183c56cc93fb8783f8d6590f1a59502d823d91f | |
parent | 9f8fb32746009873596c36127d661dcd1a8e949e (diff) | |
download | linux-fsl-qoriq-58cf78891f63e68ccfd0f225ab64e7aedfca1999.tar.xz |
crypto: caam/qi - rewrite logic on context release
The caam_drv_ctx_rel(...) function already performs a check
if the drv_ctx is NULL. But this is not enough, it must also
check if drv_ctx was set to an error code.
If these checks are done in this function, there's no need
to perfom them in caam_cra_exit(...)
Change-Id: Ia4522dd6929c3676654569b27225b6666bebdbf5
Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/12229
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Mircea Pop <mircea.pop@freescale.com>
Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
-rw-r--r-- | drivers/crypto/caam/caamalg_qi.c | 11 | ||||
-rw-r--r-- | drivers/crypto/caam/qi.c | 2 |
2 files changed, 4 insertions, 9 deletions
diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c index 6bfa967..aa0423a 100644 --- a/drivers/crypto/caam/caamalg_qi.c +++ b/drivers/crypto/caam/caamalg_qi.c @@ -2149,14 +2149,9 @@ static void caam_cra_exit(struct crypto_tfm *tfm) { struct caam_ctx *ctx = crypto_tfm_ctx(tfm); - if (ctx->drv_ctx[ENCRYPT]) - caam_drv_ctx_rel(ctx->drv_ctx[ENCRYPT]); - - if (ctx->drv_ctx[DECRYPT]) - caam_drv_ctx_rel(ctx->drv_ctx[DECRYPT]); - - if (ctx->drv_ctx[GIVENCRYPT]) - caam_drv_ctx_rel(ctx->drv_ctx[GIVENCRYPT]); + caam_drv_ctx_rel(ctx->drv_ctx[ENCRYPT]); + caam_drv_ctx_rel(ctx->drv_ctx[DECRYPT]); + caam_drv_ctx_rel(ctx->drv_ctx[GIVENCRYPT]); caam_jr_free(ctx->jrdev); } diff --git a/drivers/crypto/caam/qi.c b/drivers/crypto/caam/qi.c index 2db883c..fb37ce9 100644 --- a/drivers/crypto/caam/qi.c +++ b/drivers/crypto/caam/qi.c @@ -595,7 +595,7 @@ void caam_drv_ctx_rel(struct caam_drv_ctx *drv_ctx) { size_t size; - if (!drv_ctx) + if (IS_ERR_OR_NULL(drv_ctx)) return; size = sizeof(drv_ctx->sh_desc) + sizeof(drv_ctx->prehdr); |