diff mbox series

crypto: ixp4xx - silence uninitialized variable warning

Message ID 7de7d932-d01b-4ada-ae07-827c32438e00@kili.mountain
State Accepted
Commit a4ca033d3294bedbcc44046efeb54873631f5faf
Headers show
Series crypto: ixp4xx - silence uninitialized variable warning | expand

Commit Message

Dan Carpenter April 19, 2023, 2:26 p.m. UTC
Smatch complains that "dma" is uninitialized if dma_pool_alloc() fails.
This is true, but also harmless.  Anyway, move the assignment after the
error checking to silence this warning.

Fixes: 586d492f2856 ("crypto: ixp4xx - fix building wiht 64-bit dma_addr_t")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arnd Bergmann April 19, 2023, 2:36 p.m. UTC | #1
On Wed, Apr 19, 2023, at 16:26, Dan Carpenter wrote:
> Smatch complains that "dma" is uninitialized if dma_pool_alloc() fails.
> This is true, but also harmless.  Anyway, move the assignment after the
> error checking to silence this warning.
>
> Fixes: 586d492f2856 ("crypto: ixp4xx - fix building wiht 64-bit dma_addr_t")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Nice catch, thanks for the fix,

Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Linus Walleij April 21, 2023, 8:58 a.m. UTC | #2
On Wed, Apr 19, 2023 at 4:26 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:

> Smatch complains that "dma" is uninitialized if dma_pool_alloc() fails.
> This is true, but also harmless.  Anyway, move the assignment after the
> error checking to silence this warning.
>
> Fixes: 586d492f2856 ("crypto: ixp4xx - fix building wiht 64-bit dma_addr_t")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Herbert Xu May 12, 2023, 10:58 a.m. UTC | #3
On Wed, Apr 19, 2023 at 05:26:04PM +0300, Dan Carpenter wrote:
> Smatch complains that "dma" is uninitialized if dma_pool_alloc() fails.
> This is true, but also harmless.  Anyway, move the assignment after the
> error checking to silence this warning.
> 
> Fixes: 586d492f2856 ("crypto: ixp4xx - fix building wiht 64-bit dma_addr_t")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c b/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c
index ed15379a9818..4a18095ae5d8 100644
--- a/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c
+++ b/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c
@@ -1175,9 +1175,9 @@  static int aead_perform(struct aead_request *req, int encrypt,
 		/* The 12 hmac bytes are scattered,
 		 * we need to copy them into a safe buffer */
 		req_ctx->hmac_virt = dma_pool_alloc(buffer_pool, flags, &dma);
-		crypt->icv_rev_aes = dma;
 		if (unlikely(!req_ctx->hmac_virt))
 			goto free_buf_dst;
+		crypt->icv_rev_aes = dma;
 		if (!encrypt) {
 			scatterwalk_map_and_copy(req_ctx->hmac_virt,
 						 req->src, cryptlen, authsize, 0);