diff mbox

crypto: marvell/cesa - remove unneeded condition

Message ID 20160321090342.GB31670@mwanda (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Dan Carpenter March 21, 2016, 9:03 a.m. UTC
creq->cache[] is an array inside the struct, it's not a pointer and it
can't be NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Boris BREZILLON March 21, 2016, 9:10 a.m. UTC | #1
On Mon, 21 Mar 2016 12:03:43 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> creq->cache[] is an array inside the struct, it's not a pointer and it
> can't be NULL.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> 
> diff --git a/drivers/crypto/marvell/hash.c b/drivers/crypto/marvell/hash.c
> index 7ca2e0f..7a5058d 100644
> --- a/drivers/crypto/marvell/hash.c
> +++ b/drivers/crypto/marvell/hash.c
> @@ -768,8 +768,7 @@ static int mv_cesa_ahash_export(struct ahash_request *req, void *hash,
>  	*len = creq->len;
>  	memcpy(hash, creq->state, digsize);
>  	memset(cache, 0, blocksize);
> -	if (creq->cache)
> -		memcpy(cache, creq->cache, creq->cache_ptr);
> +	memcpy(cache, creq->cache, creq->cache_ptr);
>  
>  	return 0;
>  }
Herbert Xu April 5, 2016, 12:46 p.m. UTC | #2
On Mon, Mar 21, 2016 at 12:03:43PM +0300, Dan Carpenter wrote:
> creq->cache[] is an array inside the struct, it's not a pointer and it
> can't be NULL.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.
diff mbox

Patch

diff --git a/drivers/crypto/marvell/hash.c b/drivers/crypto/marvell/hash.c
index 7ca2e0f..7a5058d 100644
--- a/drivers/crypto/marvell/hash.c
+++ b/drivers/crypto/marvell/hash.c
@@ -768,8 +768,7 @@  static int mv_cesa_ahash_export(struct ahash_request *req, void *hash,
 	*len = creq->len;
 	memcpy(hash, creq->state, digsize);
 	memset(cache, 0, blocksize);
-	if (creq->cache)
-		memcpy(cache, creq->cache, creq->cache_ptr);
+	memcpy(cache, creq->cache, creq->cache_ptr);
 
 	return 0;
 }