[PATCH] ipsec: remove unneccessary null check

Tyler Retzlaff roretzla at linux.microsoft.com
Fri Jan 13 20:04:01 CET 2023


On Fri, Jan 13, 2023 at 10:44:25AM -0800, Stephen Hemminger wrote:
> The function rte_ring_free() accepts NULL as vaild input
> like free() and other functions.
> 
> Found with null_free_check.cocci.
> 
> Fixes: 16d6ebb65d59 ("crypto/ipsec_mb: fix null checks")
> Cc: kai.ji at intel.com
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
>  drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
> index 71e02cd0513d..3e52f9567401 100644
> --- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
> +++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
> @@ -139,15 +139,12 @@ int
>  ipsec_mb_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
>  {
>  	struct ipsec_mb_qp *qp = dev->data->queue_pairs[qp_id];
> -	struct rte_ring *r = NULL;
>  
>  	if (!qp)
>  		return 0;
>  
>  	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
> -		r = rte_ring_lookup(qp->name);
> -		if (r)
> -			rte_ring_free(r);
> +		rte_ring_free(rte_ring_lookup(qp->name));
>  
>  #if IMB_VERSION(1, 1, 0) > IMB_VERSION_NUM
>  		if (qp->mb_mgr)
> -- 

Acked-by: Tyler Retzlaff <roretzla at linux.microsoft.com>



More information about the dev mailing list