diff mbox

crypto: chcr - checking for IS_ERR() instead of NULL

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

Commit Message

Dan Carpenter Dec. 1, 2016, 8:49 p.m. UTC
The create_hash_wr() function never returns error pointers.  It returns
NULL on error.

Fixes: 358961d1cd1e ("crypto: chcr - Added new structure chcr_wr")
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

Harsh Jain Dec. 2, 2016, 5:59 a.m. UTC | #1
On 02-12-2016 02:19, Dan Carpenter wrote:
> The create_hash_wr() function never returns error pointers.  It returns
> NULL on error.
Will fix the same, Thanks
>
> Fixes: 358961d1cd1e ("crypto: chcr - Added new structure chcr_wr")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
> index 32361dd..2ed1e24 100644
> --- a/drivers/crypto/chelsio/chcr_algo.c
> +++ b/drivers/crypto/chelsio/chcr_algo.c
> @@ -958,9 +958,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;
> @@ -1023,8 +1022,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);
> @@ -1074,8 +1073,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);
> @@ -1125,8 +1124,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);

--
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
Harsh Jain Dec. 2, 2016, 6:12 a.m. UTC | #2
On 02-12-2016 11:29, Harsh Jain wrote:
>
> On 02-12-2016 02:19, Dan Carpenter wrote:
>> The create_hash_wr() function never returns error pointers.  It returns
>> NULL on error.
> Will fix the same, Thanks
It's a patch mail not bug reporting!  Sorry for confusion. You have already fixed it. Thanks.
>> Fixes: 358961d1cd1e ("crypto: chcr - Added new structure chcr_wr")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>
>> diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
>> index 32361dd..2ed1e24 100644
>> --- a/drivers/crypto/chelsio/chcr_algo.c
>> +++ b/drivers/crypto/chelsio/chcr_algo.c
>> @@ -958,9 +958,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;
>> @@ -1023,8 +1022,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);
>> @@ -1074,8 +1073,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);
>> @@ -1125,8 +1124,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);

--
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
Herbert Xu Dec. 7, 2016, 12:07 p.m. UTC | #3
On Thu, Dec 01, 2016 at 11:49:37PM +0300, Dan Carpenter wrote:
> The create_hash_wr() function never returns error pointers.  It returns
> NULL on error.
> 
> Fixes: 358961d1cd1e ("crypto: chcr - Added new structure chcr_wr")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied.  Thanks.
diff mbox

Patch

diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index 32361dd..2ed1e24 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -958,9 +958,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;
@@ -1023,8 +1022,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);
@@ -1074,8 +1073,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);
@@ -1125,8 +1124,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);