[PATCH v2 10/83] examples/vhost_blk: remove unnecessary NULL checks

Xia, Chenbo chenbo.xia at intel.com
Thu Jan 27 06:53:06 CET 2022


> -----Original Message-----
> From: Stephen Hemminger <stephen at networkplumber.org>
> Sent: Tuesday, January 25, 2022 1:46 AM
> To: dev at dpdk.org
> Cc: Stephen Hemminger <stephen at networkplumber.org>; Maxime Coquelin
> <maxime.coquelin at redhat.com>; Xia, Chenbo <chenbo.xia at intel.com>
> Subject: [PATCH v2 10/83] examples/vhost_blk: remove unnecessary NULL checks
> 
> Remove redundant NULL pointer checks before free functions
> found by nullfree.cocci
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
>  examples/vhost_blk/vhost_blk.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/examples/vhost_blk/vhost_blk.c b/examples/vhost_blk/vhost_blk.c
> index feadacc62ee5..2cab1e6994fe 100644
> --- a/examples/vhost_blk/vhost_blk.c
> +++ b/examples/vhost_blk/vhost_blk.c
> @@ -849,8 +849,7 @@ static void
>  vhost_blk_ctrlr_destroy(struct vhost_blk_ctrlr *ctrlr)
>  {
>  	if (ctrlr->bdev != NULL) {
> -		if (ctrlr->bdev->data != NULL)
> -			rte_free(ctrlr->bdev->data);
> +		rte_free(ctrlr->bdev->data);
> 
>  		rte_free(ctrlr->bdev);
>  	}
> --
> 2.30.2

Reviewed-by: Chenbo Xia <chenbo.xia at intel.com>


More information about the dev mailing list