Skip to content

Commit

Permalink
crypto: chcr - checking for IS_ERR() instead of NULL
Browse files Browse the repository at this point in the history
The create_hash_wr() function never returns error pointers.  It returns
NULL on error.

Fixes: 358961d ("crypto: chcr - Added new structure chcr_wr")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Dan Carpenter authored and Herbert Xu committed Dec 7, 2016
1 parent b80609a commit 9a97ffd
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions drivers/crypto/chelsio/chcr_algo.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,9 +956,8 @@ static int chcr_ahash_update(struct ahash_request *req)
req_ctx->result = 0;
req_ctx->data_len += params.sg_len + params.bfr_len;
skb = create_hash_wr(req, &params);

if (IS_ERR(skb))
return PTR_ERR(skb);
if (!skb)
return -ENOMEM;

if (remainder) {
u8 *temp;
Expand Down Expand Up @@ -1021,8 +1020,8 @@ static int chcr_ahash_final(struct ahash_request *req)
params.more = 0;
}
skb = create_hash_wr(req, &params);
if (IS_ERR(skb))
return PTR_ERR(skb);
if (!skb)
return -ENOMEM;

skb->dev = u_ctx->lldi.ports[0];
set_wr_txq(skb, CPL_PRIORITY_DATA, ctx->tx_channel_id);
Expand Down Expand Up @@ -1072,8 +1071,8 @@ static int chcr_ahash_finup(struct ahash_request *req)
}

skb = create_hash_wr(req, &params);
if (IS_ERR(skb))
return PTR_ERR(skb);
if (!skb)
return -ENOMEM;

skb->dev = u_ctx->lldi.ports[0];
set_wr_txq(skb, CPL_PRIORITY_DATA, ctx->tx_channel_id);
Expand Down Expand Up @@ -1123,8 +1122,8 @@ static int chcr_ahash_digest(struct ahash_request *req)
}

skb = create_hash_wr(req, &params);
if (IS_ERR(skb))
return PTR_ERR(skb);
if (!skb)
return -ENOMEM;

skb->dev = u_ctx->lldi.ports[0];
set_wr_txq(skb, CPL_PRIORITY_DATA, ctx->tx_channel_id);
Expand Down

0 comments on commit 9a97ffd

Please sign in to comment.