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 E720EA034E; Wed, 9 Feb 2022 20:19:01 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B83CD4114B; Wed, 9 Feb 2022 20:18:06 +0100 (CET) Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mails.dpdk.org (Postfix) with ESMTP id A1225411C3 for ; Wed, 9 Feb 2022 20:18:03 +0100 (CET) Received: by mail-pl1-f182.google.com with SMTP id y7so3091506plp.2 for ; Wed, 09 Feb 2022 11:18:03 -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=iUql+RBfSDe37LATZ/9PzeTRIDEWDLKaHE5yJ2E7sdk=; b=ctaXCYw24YCjTunQkfRClDEjdyRfiuna5b8Fr3ww9D3J6ZeOHMVVoRiXKmEl1+QQjI d588crBYaqxmYMvrsvix0knhRrcjm3cXHkNQD1gq4yQEYN0dHUuezx8RonjW80dUv62x A6rRVkJe6iP+LtrjuOHOSlopTryDu1mycgmNdxsubSMOhPoMGZPWhF3/Di+kklHsTZa9 T1PWvSFowiC/zm49kW/iWYuZHLvWGwqZ92b2QLSlgS3lDDIPnbcB2mrjK1PpR/uIShMz 0A7u4uB7uikF6nqDD51k3y850E6c8qcvy/M9lmwLiyt5baSiURwjbsQ3U02WM+0yiTiX GajQ== 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=iUql+RBfSDe37LATZ/9PzeTRIDEWDLKaHE5yJ2E7sdk=; b=Auy+tyA3hTcmleJrrBBYrdO9OPGXgNISNhsiGZ7mdSj91iGs6IWdAi4D17OF+EOGYJ PVAd5zQyYtHpU6FwcT9asdoat2WMo43lcAsWGfsTKNmMb9NKnPSLoryo2hABWfyHG/6d b/QiU5hxkGFUoEmYb3KidKkaOmEjyw7KgFAnoEEmOl5ArbB6twO1dFU5jl6DDLU35lA2 TOZInL7Jh19BPVfgFvw+/M1avxuh8bITgcBGyU8jEACGIRUOgORtdqytUCnhVBTu6g51 p4pdC4EgpNb4AIAJPM82RgdEVjFPWLook/5x+6HDmUHYJkDTOyer0234hkoihQqUcGgm moHQ== X-Gm-Message-State: AOAM531kB1RHm0q0Nk1Ss4zi3zfYtWdsPfeDXYJjqgeQZiaqLi5awSnN zmdyEQevCgGPOKI1Dq1OBJhGI7DvlF7/ujXr X-Google-Smtp-Source: ABdhPJz6mgw1FUSihVU9JUCR2aqtunxbXTZSC1NVS9fj5aLiWPUfDts6LfM+ZyYXRcpvXBf6AChMgA== X-Received: by 2002:a17:902:a508:: with SMTP id s8mr3805205plq.173.1644434282468; Wed, 09 Feb 2022 11:18:02 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 11:18:01 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Hemant Agrawal , Sachin Saxena , Rosen Xu Subject: [PATCH v3 09/36] bus/*: remove unnecessary NULL checks Date: Wed, 9 Feb 2022 11:17:21 -0800 Message-Id: <20220209191748.377729-10-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 Acked-by: Hemant Agrawal --- drivers/bus/fslmc/fslmc_bus.c | 6 ++---- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 6 ++---- drivers/bus/ifpga/ifpga_bus.c | 12 ++++-------- drivers/bus/pci/pci_params.c | 3 +-- drivers/bus/pci/windows/pci.c | 3 +-- drivers/bus/pci/windows/pci_netuio.c | 3 +-- 6 files changed, 11 insertions(+), 22 deletions(-) diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index 356253f6b412..e9edc27e0ab0 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -221,13 +221,11 @@ scan_one_fslmc_device(char *dev_name) insert_in_device_list(dev); /* Don't need the duplicated device filesystem entry anymore */ - if (dup_dev_name) - free(dup_dev_name); + free(dup_dev_name); return 0; cleanup: - if (dup_dev_name) - free(dup_dev_name); + free(dup_dev_name); if (dev) { rte_intr_instance_free(dev->intr_handle); free(dev); diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c index 52605ea2c32c..943fadee4816 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c @@ -149,8 +149,7 @@ dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id, int cpu_id) if (!token) { DPAA2_BUS_WARN("Failed to get interrupt id for dpio.%d", dpio_id); - if (temp) - free(temp); + free(temp); fclose(file); return; } @@ -574,8 +573,7 @@ dpaa2_free_dq_storage(struct queue_storage_info_t *q_storage) int i = 0; for (i = 0; i < NUM_DQS_PER_QUEUE; i++) { - if (q_storage->dq_storage[i]) - rte_free(q_storage->dq_storage[i]); + rte_free(q_storage->dq_storage[i]); } } diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index c5c8bbd57219..e005f2cb70b3 100644 --- a/drivers/bus/ifpga/ifpga_bus.c +++ b/drivers/bus/ifpga/ifpga_bus.c @@ -191,10 +191,8 @@ ifpga_scan_one(struct rte_rawdev *rawdev, return afu_dev; end: - if (kvlist) - rte_kvargs_free(kvlist); - if (path) - free(path); + rte_kvargs_free(kvlist); + free(path); if (afu_dev) { rte_intr_instance_free(afu_dev->intr_handle); free(afu_dev); @@ -254,10 +252,8 @@ ifpga_scan(void) } end: - if (kvlist) - rte_kvargs_free(kvlist); - if (name) - free(name); + rte_kvargs_free(kvlist); + free(name); return 0; } diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c index 60b424b8297e..61a868707f16 100644 --- a/drivers/bus/pci/pci_params.c +++ b/drivers/bus/pci/pci_params.c @@ -117,8 +117,7 @@ rte_pci_devargs_parse(struct rte_devargs *da) rte_pci_device_name(&addr, da->name, sizeof(da->name)); out: - if (kvargs != NULL) - rte_kvargs_free(kvargs); + rte_kvargs_free(kvargs); if (ret != 0) rte_errno = -ret; return ret; diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c index 39ba31be7d38..7bf091158ba2 100644 --- a/drivers/bus/pci/windows/pci.c +++ b/drivers/bus/pci/windows/pci.c @@ -418,8 +418,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data) return 0; end: - if (dev) - free(dev); + free(dev); return ret; } diff --git a/drivers/bus/pci/windows/pci_netuio.c b/drivers/bus/pci/windows/pci_netuio.c index a0b175a8fca0..5460399eea5f 100644 --- a/drivers/bus/pci/windows/pci_netuio.c +++ b/drivers/bus/pci/windows/pci_netuio.c @@ -180,8 +180,7 @@ get_netuio_device_info(HDEVINFO dev_info, PSP_DEVINFO_DATA dev_info_data, CloseHandle(netuio); } - if (dev_ifx_detail) - free(dev_ifx_detail); + free(dev_ifx_detail); if (di_set != INVALID_HANDLE_VALUE) SetupDiDestroyDeviceInfoList(di_set); -- 2.34.1