[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8e08adcb-ef91-124d-d093-921fc97da3af@nxp.com>
Date: Thu, 18 Jun 2020 13:54:55 +0300
From: Horia Geantă <horia.geanta@....com>
To: Colin King <colin.king@...onical.com>,
Aymen Sghaier <aymen.sghaier@....com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S . Miller" <davem@...emloft.net>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>
Cc: "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] crypto: caam/qi2: remove redundant assignment to ret
On 6/11/2020 6:39 PM, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> The variable ret is being assigned a value that is never read, the
> error exit path via label 'unmap' returns -ENOMEM anyhow, so assigning
> ret with -ENOMEM is redundamt.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
> drivers/crypto/caam/caamalg_qi2.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c
> index 28669cbecf77..ef2c4e095db3 100644
> --- a/drivers/crypto/caam/caamalg_qi2.c
> +++ b/drivers/crypto/caam/caamalg_qi2.c
> @@ -4044,7 +4044,6 @@ static int ahash_finup_no_ctx(struct ahash_request *req)
> DMA_TO_DEVICE);
> if (dma_mapping_error(ctx->dev, edesc->qm_sg_dma)) {
> dev_err(ctx->dev, "unable to map S/G table\n");
> - ret = -ENOMEM;
> goto unmap;
> }
> edesc->qm_sg_bytes = qm_sg_bytes;
> @@ -4055,7 +4054,6 @@ static int ahash_finup_no_ctx(struct ahash_request *req)
> if (dma_mapping_error(ctx->dev, state->ctx_dma)) {
> dev_err(ctx->dev, "unable to map ctx\n");
> state->ctx_dma = 0;
> - ret = -ENOMEM;
> goto unmap;
> }
>
The proper fix would be updating the ahash_finup_no_ctx() function
to return the specific error code:
return ret;
instead of returning -ENOMEM for all error cases.
For example error code returned by dpaa2_caam_enqueue()
should be returned instead of -ENOMEM.
Horia
Powered by blists - more mailing lists