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 85EE4A034E; Wed, 9 Feb 2022 20:21:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 65A1B42734; Wed, 9 Feb 2022 20:18:32 +0100 (CET) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mails.dpdk.org (Postfix) with ESMTP id 2C13142727 for ; Wed, 9 Feb 2022 20:18:31 +0100 (CET) Received: by mail-pj1-f52.google.com with SMTP id d15-20020a17090a564f00b001b937f4ae2fso800807pji.4 for ; Wed, 09 Feb 2022 11:18:31 -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=cDxMjDlgQtmf3AIP8J3vn/tePP0J4nDRVflob25/+kw=; b=7TeuHWGACtU7y3cIn/mLZjTezG2MdybmSEpwaCP8Dm+DZ3AzTiiVr9AmO0KY6tiaBR 7fB9PRe+VWsAgpgdGJ83cnkrvXivw7OiXlqmUtS3yvnaAez0U9/UiHM1g44PGqsZePXa qslbA+6nxkALKi+vGnY0KlhwI72ohDZ3Wd+y0ONAORqlF+DyB/Xq1f4iuvBmy0Znn+bT tllcmGFGvOIdbn7ogSN4aSHhYWPxLAfGyRrwKcZfAe3Y2RZFjCoQjzuIG5hsYdl7jZEq gqajXyO2Kx8kX0yKGRVvzjvyYcHyg/27mUj9sWj5dJiH/yXbwa2ddKT/KaNeVnPfTykS ZfNg== 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=cDxMjDlgQtmf3AIP8J3vn/tePP0J4nDRVflob25/+kw=; b=yXCUWiZcsYtfkm7uudZvqqlaDmiuOhvKptAERw+7w3fN7KhPPcKiHVvg5D6iQLUKhs ce30dkLHol/VO1KT0tzfzjCh4xOYpuj3i9p8mBrskIuRADJs6dfkbffaB0hJWfwyQ+j/ mlCDnabCmHuEtWC5ONgZdENiW542zI0avpvPI2oZ+BhDjsnFhgPCTJAWbRRRiHAPZV5r UDAJ270fV+NYFk2mkjhLz0g1Jcm5UpyQTn+uoyYwNseHdxU3k2o5gD9AZ0hRnct6qJQQ wqPUcGuIt3DIYuqmfzDcw3jvODgKiXfX/61v/cpLm47+q1i+QQaMc2BHYxERP38m+/+I HilA== X-Gm-Message-State: AOAM5320I2lhdJReN6FyHynJR/c9ZQwn3J3UqCHXB/h7Dn1Tds0S10Yi 2CuOvZkfvfeHBThrGpmmKQ5pMkOXkgCA0QFuzZ0= X-Google-Smtp-Source: ABdhPJyiJ4h722Cp+9pNWs1ZWLTzlQqCQdwOPG8+zEesUh9Eaf0Xm8rB2NFb3cdMzXI1MlXqRFEgCw== X-Received: by 2002:a17:903:2448:: with SMTP id l8mr3609008pls.84.1644434310108; Wed, 09 Feb 2022 11:18:30 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 11:18:29 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Hemant Agrawal , Jakub Palider , Tomasz Duszynski , Nipun Gupta , Rosen Xu , Tianfei zhang Subject: [PATCH v3 32/36] raw/*: remove unnecessary NULL checks Date: Wed, 9 Feb 2022 11:17:44 -0800 Message-Id: <20220209191748.377729-33-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/raw/cnxk_bphy/cnxk_bphy_cgx.c | 3 +-- drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 15 +++++---------- drivers/raw/ifpga/ifpga_rawdev.c | 9 +++------ drivers/raw/skeleton/skeleton_rawdev_test.c | 6 ++---- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c index 0b694e1c03c3..169cbc785531 100644 --- a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c +++ b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c @@ -233,8 +233,7 @@ cnxk_bphy_cgx_fini_queues(struct cnxk_bphy_cgx *cgx) unsigned int i; for (i = 0; i < cgx->num_queues; i++) { - if (cgx->queues[i].rsp) - rte_free(cgx->queues[i].rsp); + rte_free(cgx->queues[i].rsp); } cgx->num_queues = 0; diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c index ebc2cd5d0ddc..b2260439a4ef 100644 --- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c +++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c @@ -1115,11 +1115,9 @@ dpaa2_qdma_reset(struct rte_rawdev *rawdev) /* Reset and free virtual queues */ for (i = 0; i < qdma_dev->max_vqs; i++) { - if (qdma_dev->vqs[i].status_ring) - rte_ring_free(qdma_dev->vqs[i].status_ring); + rte_ring_free(qdma_dev->vqs[i].status_ring); } - if (qdma_dev->vqs) - rte_free(qdma_dev->vqs); + rte_free(qdma_dev->vqs); qdma_dev->vqs = NULL; /* Reset per core info */ @@ -1314,8 +1312,7 @@ dpaa2_qdma_queue_setup(struct rte_rawdev *rawdev, if (qdma_dev->vqs[i].hw_queue == NULL) { DPAA2_QDMA_ERR("No H/W queue available for VQ"); - if (qdma_dev->vqs[i].status_ring) - rte_ring_free(qdma_dev->vqs[i].status_ring); + rte_ring_free(qdma_dev->vqs[i].status_ring); qdma_dev->vqs[i].status_ring = NULL; rte_spinlock_unlock(&qdma_dev->lock); return -ENODEV; @@ -1516,14 +1513,12 @@ dpaa2_qdma_queue_release(struct rte_rawdev *rawdev, if (qdma_vq->exclusive_hw_queue) free_hw_queue(qdma_vq->hw_queue); else { - if (qdma_vq->status_ring) - rte_ring_free(qdma_vq->status_ring); + rte_ring_free(qdma_vq->status_ring); put_hw_queue(qdma_vq->hw_queue); } - if (qdma_vq->fle_pool) - rte_mempool_free(qdma_vq->fle_pool); + rte_mempool_free(qdma_vq->fle_pool); memset(qdma_vq, 0, sizeof(struct qdma_virt_queue)); diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c index fdf3c23d2c5f..b73512d3ada5 100644 --- a/drivers/raw/ifpga/ifpga_rawdev.c +++ b/drivers/raw/ifpga/ifpga_rawdev.c @@ -836,8 +836,7 @@ rte_fpga_do_pr(struct rte_rawdev *rawdev, int port_id, } free_buffer: - if (buf_to_free) - rte_free(buf_to_free); + rte_free(buf_to_free); close_fd: close(file_fd); file_fd = 0; @@ -1739,10 +1738,8 @@ ifpga_cfg_probe(struct rte_vdev_device *dev) ret = rte_eal_hotplug_add(RTE_STR(IFPGA_BUS_NAME), dev_name, devargs->args); end: - if (kvlist) - rte_kvargs_free(kvlist); - if (name) - free(name); + rte_kvargs_free(kvlist); + free(name); return ret; } diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c index 484468eeb460..693b24c415de 100644 --- a/drivers/raw/skeleton/skeleton_rawdev_test.c +++ b/drivers/raw/skeleton/skeleton_rawdev_test.c @@ -395,13 +395,11 @@ test_rawdev_enqdeq(void) RTE_TEST_ASSERT_EQUAL((unsigned int)ret, count, "Unable to dequeue buffers"); - if (deq_buffers) - free(deq_buffers); + free(deq_buffers); return TEST_SUCCESS; cleanup: - if (buffers[0].buf_addr) - free(buffers[0].buf_addr); + free(buffers[0].buf_addr); return TEST_FAILED; } -- 2.34.1