From patchwork Fri Aug 4 16:41:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 129913 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5864142FD6; Fri, 4 Aug 2023 18:42:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E343540EF1; Fri, 4 Aug 2023 18:42:09 +0200 (CEST) Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by mails.dpdk.org (Postfix) with ESMTP id F0B9240EE1 for ; Fri, 4 Aug 2023 18:42:08 +0200 (CEST) Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-686f94328a4so1591600b3a.0 for ; Fri, 04 Aug 2023 09:42:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1691167327; x=1691772127; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IJZkIxO7UjaaKnH5XVrv0eS4v9RXyL5HHQaWeWLajSk=; b=ukSwd92BR7LOI6oZLUCKAFMMd2ZZ+oqPsMADLYaf7HX2IBC03PMDbRRA83+D9yHI5D rRfccQ+SuTpP3IUtJbowtb2wEAJ53uboeEvw+BfiA3MufLXCYQN80jgWA8f5f2mvreZm Ie9tDIN9gMBxku9/rShhTYqXBk3kIiAJ9LFxkj7u3QfyQSebhvXo6dJoeg3Ky8G0srWn 1sJpZ2MCi4hdtw1i3p6S1bio0/TsSnt/bM6GiSnkB0Sg7up1cKtzLAGAID0jFrJKg5Fn tQtYijVbP5xB1mOsXuN02O0gOuezt1qv9cU1vMF6ttN1sJE5XjyN59u27vCF17GmUn1N pq+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691167327; x=1691772127; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IJZkIxO7UjaaKnH5XVrv0eS4v9RXyL5HHQaWeWLajSk=; b=GPuCgeeZIAWtSOiTCFzQOgDnKVpBn90nOjxH7sVcKxBYWZSCjkJRg7PXK7J69BPKDx BXECWECY7XqSFG0sx8I7PhwJaOB7a+PKO1toi+jZkdYsFdmVFPRnAlMedWcvQ2+eVqKI ZNzJgwFsfJWn9xeCvTNfySTOSxWf6ZZLSu5kfIQdqp9rXVwj0hEXFSerbKJ/p9nJVDAa Wc7yesBiO07tDIvoQX43pw+l8Aw6DOwnnje40uwv2thtaEgCi2LDLTeMrMxe8THgPcOE ZxYX7jCagLoCBz4x1sMkBI/5s5ntRnbiKIA9P0WZTnbwv8EzNUjiK4Z6nk2qO9uMo+8/ AntA== X-Gm-Message-State: AOJu0YyhB9m1WhHN7gDK+FvZUFdP5T/2+gvZLatUu3kyST0yGgp1RYHw DDlYW4ChPzYSJx7Be3Ekezju0/fVUqhwoOjXoWAlzg== X-Google-Smtp-Source: AGHT+IGRBRQl9qIMJrvn5uJ6k6jGSEhEskQqmPGJvmjBaZNNIE+LUuWmBEEY5+yhJnxDrdMS9OvkJg== X-Received: by 2002:a05:6a20:8f0c:b0:138:68b9:138e with SMTP id b12-20020a056a208f0c00b0013868b9138emr319428pzk.8.1691167327572; Fri, 04 Aug 2023 09:42:07 -0700 (PDT) Received: from hermes.local (204-195-127-207.wavecable.com. [204.195.127.207]) by smtp.gmail.com with ESMTPSA id k188-20020a633dc5000000b0056420d3cd20sm1361356pga.71.2023.08.04.09.42.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 09:42:06 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Akhil Goyal , Fan Zhang , Konstantin Ananyev Subject: [PATCH 1/2] app/test: remove unnecessary null check before free Date: Fri, 4 Aug 2023 09:41:55 -0700 Message-Id: <20230804164156.118331-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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 No need to check for NULL pointer before calling these functions Found by cocci/nullfree.cocci. Signed-off-by: Stephen Hemminger --- app/test/test_cryptodev_asym.c | 3 +-- app/test/test_reassembly_perf.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c index 0ef2642fdd2b..c43a063b8262 100644 --- a/app/test/test_cryptodev_asym.c +++ b/app/test/test_cryptodev_asym.c @@ -565,8 +565,7 @@ ut_teardown_asym(void) if (self->sess != NULL) rte_cryptodev_asym_session_free(dev_id, self->sess); - if (self->op != NULL) - rte_crypto_op_free(self->op); + rte_crypto_op_free(self->op); self->sess = NULL; self->op = NULL; self->result_op = NULL; diff --git a/app/test/test_reassembly_perf.c b/app/test/test_reassembly_perf.c index c11b65291fec..3af104b67348 100644 --- a/app/test/test_reassembly_perf.c +++ b/app/test/test_reassembly_perf.c @@ -81,8 +81,7 @@ reassembly_test_teardown(void) if (frag_tbl != NULL) rte_ip_frag_table_destroy(frag_tbl); - if (pkt_pool != NULL) - rte_mempool_free(pkt_pool); + rte_mempool_free(pkt_pool); } static void From patchwork Fri Aug 4 16:41:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 129914 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E9FD142FD6; Fri, 4 Aug 2023 18:42:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DDDD643247; Fri, 4 Aug 2023 18:42:10 +0200 (CEST) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mails.dpdk.org (Postfix) with ESMTP id A600240EE1 for ; Fri, 4 Aug 2023 18:42:09 +0200 (CEST) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-686b91c2744so1705450b3a.0 for ; Fri, 04 Aug 2023 09:42:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1691167328; x=1691772128; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DSV+SsTo/8KBtkmUplEZqD7+GIgTAYMHWPBS5sHOQkE=; b=LLMklf4AfnbFeZRxmEFzuHrJweb1kRvSPOxOTWnnStA+Q9H3ws6zSQWNpnCHSWgWb7 v273FKqW07bQyLPpdGhUeYVM3E+li9fUKfeOILuc8kEWHA7/S14ORkipS+x55i/bfJCR V6AXgC2pF/RQMUBNJ/WbdABvO49Zbh9atuGVxjRLoHsPRvTy0MAasFz+8R1o4qCx+ndo UV1hmb7+YkqXlC5HQ7tHdLZbFR6h+n4z9bKIC3LfHIirzsxsmI1OHnijnftaBPNsUJg0 MMkYzdfQU4yt17lYd43mr0aY3nTMOierXUsSi/NTpfcwQuKVA3GRpC0+YOb8Bx4ll6Rp JBpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691167328; x=1691772128; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DSV+SsTo/8KBtkmUplEZqD7+GIgTAYMHWPBS5sHOQkE=; b=Po203pAx6r31fyNJmbb1Sc7xOjPba3xoujUdp4Z08Eu9ha35pEloXpml5AgvCXO+MW QwQ9f/zjhE4r+R+WmOqb9DsR6PXeqNMTmDMmP5JrUmADiuFmggbImZXda/kKG1n93CUy G28eeKjTGPC6DYDRlti4tHUnPEiTf5tPCssLUZ6J5lI9/jghsq6wV4oyVHoixmOtfFpT +aJsZaiojT2/lFzbzmBpI6L99NZcfKGK96N0xpvSZWyVowBtl7ltGn0H1g9zD+HN2y0f dZdCExtvExiWJXIJ/iOXQBC6yHjhrZbEHYXOPkgS9OPRxi6NlYxaIrpRyJXg5ez8p5jd 5pQw== X-Gm-Message-State: AOJu0Ywal7pOzuQ3ln5ubXUxPdQJPZU+LGNNS/Vwvob57/AEpgaYb/Mr BDVb/uJCwa7+5zfCSB0fixIc6sje42MFQonYyKbtRg== X-Google-Smtp-Source: AGHT+IGMj25kWAWmWnHkfog4wMrGXqlOBTPWbhNWq1YlTGLki+9ocLPlCGyMZbUNRo1NJAMM0hUW7A== X-Received: by 2002:a05:6a00:2e0f:b0:687:3f06:5939 with SMTP id fc15-20020a056a002e0f00b006873f065939mr2498902pfb.32.1691167328644; Fri, 04 Aug 2023 09:42:08 -0700 (PDT) Received: from hermes.local (204-195-127-207.wavecable.com. [204.195.127.207]) by smtp.gmail.com with ESMTPSA id k188-20020a633dc5000000b0056420d3cd20sm1361356pga.71.2023.08.04.09.42.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 09:42:08 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Ajit Khaparde , Somnath Kotur Subject: [PATCH 2/2] net/bnxt: remove unnecessary check for null before free Date: Fri, 4 Aug 2023 09:41:56 -0700 Message-Id: <20230804164156.118331-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230804164156.118331-1-stephen@networkplumber.org> References: <20230804164156.118331-1-stephen@networkplumber.org> MIME-Version: 1.0 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 No need to check for null pointer before calling rte_free(). Found by cocci/nullfree.cocci script. Signed-off-by: Stephen Hemminger --- drivers/net/bnxt/bnxt_ethdev.c | 3 +-- drivers/net/bnxt/bnxt_vnic.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index ee1552452a11..ec8e441a6d05 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -6002,8 +6002,7 @@ static void bnxt_free_ctx_mem_buf(struct bnxt_ctx_mem_buf_info *ctx) if (!ctx) return; - if (ctx->va) - rte_free(ctx->va); + rte_free(ctx->va); ctx->va = NULL; ctx->dma = RTE_BAD_IOVA; diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index 2be456956ddc..f86d27fd7965 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -847,8 +847,7 @@ bnxt_vnic_rss_hash_algo_update(struct bnxt *bp, int32_t bnxt_vnic_queue_db_deinit(struct bnxt *bp) { - if (bp->vnic_queue_db.rss_q_db != NULL) - rte_hash_free(bp->vnic_queue_db.rss_q_db); + rte_hash_free(bp->vnic_queue_db.rss_q_db); return 0; }