From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 15081A034E; Wed, 9 Feb 2022 20:21:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3221342737; Wed, 9 Feb 2022 20:18:35 +0100 (CET) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id 717A24270C for ; Wed, 9 Feb 2022 20:18:33 +0100 (CET) Received: by mail-pl1-f177.google.com with SMTP id j4so3060170plj.8 for ; Wed, 09 Feb 2022 11:18:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VcTC6r854HlMStXEA9xMonw6pBu8ZnKrQ3CtZuxZ+bM=; b=p8V9sQqN2FvKzfM8N1RxoWrELsOBwRi05crbrgLQAWXs4bO5J9DSztQs1cBi5recm5 0AQIyA44+SPraFjAg2iN56hr4vQePVglOUnr+PnIKKH2wUcLm6UCb97j3QK2stumtZVQ UE/l3O9hJXWqzYTBXzavxonj3/YInT0lQ0LL9ecuP+TawYvIyC99rPvfUFrVv9zBdnUU jjCvO275bKXA4DVOqsAWjmL/qltyqnQoL8ZbE9U6e9FGR+m2n/NvlgkdjoDNaXbB+TvX eqttpsPKl17+S/yFz7ZWSfKBcLdqTv8v9qAhE+8YlqFEmvleNzBYHKov5mQFWDeEwmZo KPeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VcTC6r854HlMStXEA9xMonw6pBu8ZnKrQ3CtZuxZ+bM=; b=UBq8asRjBoPTe9+7yc3LlnkSfjloclsXciFI5fU+lBTekQZ7JWotQiCb0qGjvE1Eu+ cWfPqXUnivHeX/ScqaLfOroD1AFpq1pSYNkVHwN+jc3IInOxfqQ+7E9YCWx4I/txuPBT bxsSzPxEaGMUMaUL1LvV7kagZTR9AV7HrphXvZhldE26KbWY6keScci6SHp/f1QAoxtm o0qMF7GVzpSxcp4kOdyJ/ndEcYfCOn+sHKVBGkhnlPAh4jGA9mgHkyYe9UFyxp4OkWYf vwd/Bkiy8a3yDExPguT9Ga0PksJWd7SLc1TwHUJnE2zT96WqSZ0G8y7d65zKVSRla+pG Z8fQ== X-Gm-Message-State: AOAM532Ie9dDG9wgEwntbn+kKo/xaWZqEjlHFwJScT9IJ6DOakNPgjSd nzpjjY7ScfVPtGv6JuxASluTDWMVGd+jjMbLdM8= X-Google-Smtp-Source: ABdhPJyRDrlRQrWC97XMPCNZBsBiJ776zHClmmmqIphjzjjF+kjMaULovyZWUMIADePUDAH4CObHkg== X-Received: by 2002:a17:90a:59:: with SMTP id 25mr2729199pjb.195.1644434312427; Wed, 09 Feb 2022 11:18:32 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u16sm14378401pgh.54.2022.02.09.11.18.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 11:18:31 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Chenbo Xia , Xiao Wang , Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH v3 34/36] vdpa/*: remove unnecessary NULL checks Date: Wed, 9 Feb 2022 11:17:46 -0800 Message-Id: <20220209191748.377729-35-stephen@networkplumber.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220209191748.377729-1-stephen@networkplumber.org> References: <20220124000518.319850-1-stephen@networkplumber.org> <20220209191748.377729-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Remove redundant NULL pointer checks before free functions found by nullfree.cocci Signed-off-by: Stephen Hemminger Reviewed-by: Chenbo Xia --- drivers/vdpa/ifc/ifcvf_vdpa.c | 9 +++------ drivers/vdpa/mlx5/mlx5_vdpa_mem.c | 3 +-- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 3 +-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index 3853c4cf7e85..9f05595b6b34 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -226,8 +226,7 @@ ifcvf_dma_map(struct ifcvf_internal *internal, bool do_map) } exit: - if (mem) - free(mem); + free(mem); return ret; } @@ -253,8 +252,7 @@ hva_to_gpa(int vid, uint64_t hva) } exit: - if (mem) - free(mem); + free(mem); return gpa; } @@ -661,8 +659,7 @@ m_ifcvf_start(struct ifcvf_internal *internal) error: for (i = 0; i < nr_vring; i++) - if (internal->m_vring[i].desc) - rte_free(internal->m_vring[i].desc); + rte_free(internal->m_vring[i].desc); return -1; } diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_mem.c b/drivers/vdpa/mlx5/mlx5_vdpa_mem.c index 130d201a85f5..599079500b03 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_mem.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_mem.c @@ -283,8 +283,7 @@ mlx5_vdpa_mem_register(struct mlx5_vdpa_priv *priv) priv->gpa_mkey_index = entry->mkey->id; return 0; error: - if (entry) - rte_free(entry); + rte_free(entry); mlx5_vdpa_mem_dereg(priv); rte_errno = -ret; return ret; diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c index 2f32aef67fbc..3416797d289c 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c @@ -91,8 +91,7 @@ mlx5_vdpa_virtq_unset(struct mlx5_vdpa_virtq *virtq) if (virtq->umems[i].obj) claim_zero(mlx5_glue->devx_umem_dereg (virtq->umems[i].obj)); - if (virtq->umems[i].buf) - rte_free(virtq->umems[i].buf); + rte_free(virtq->umems[i].buf); } memset(&virtq->umems, 0, sizeof(virtq->umems)); if (virtq->eqp.fw_qp) -- 2.34.1