From patchwork Sun Feb 20 00:51:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 107850 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 96F72A00C2; Sun, 20 Feb 2022 01:51:51 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE59E41104; Sun, 20 Feb 2022 01:51:48 +0100 (CET) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTP id 68D924014E for ; Sun, 20 Feb 2022 01:51:45 +0100 (CET) Received: by mail-pj1-f48.google.com with SMTP id y16so3564506pjt.0 for ; Sat, 19 Feb 2022 16:51:45 -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=anItR6KFA+9+sIVGR/TKu9iEdVKIL5VDhmPHijptnwk=; b=1VX1SBtVEvLmNRSD0MvEcqgtXBZGD4gVD3KfhlwZT7iLBcB/k19cq2Fy3ZFfgOYZ4/ qQAwGYbWw/ZLZJXiwLYa2gYwhazFUbwu2wI85i6ekgJv/WMgu+g8WDVpXko5UVQRjlpH LFymzOvGiJhNdWS7wUZXBAzLV3gmGvnDTA3zvgVp329GMYguUdvL5OYBAM8H9xssLOKa 457IlQL2ASihB1OcE+Y5S92kXrBQf1Ycaj9CIt3lEGkk7Ok5P4Y0IGZz4d8VVJVXw+Rc lkz9B3BhVuxmMXgkniqffYrYclwT6n2RpEKpsJ+5kabaYiW2UPBhSoyitqexEE7bM5pW aTAA== 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=anItR6KFA+9+sIVGR/TKu9iEdVKIL5VDhmPHijptnwk=; b=bi9H/Aj/+JAtKVvES3vSGdsxp4KPvok/FZuOplVNeX5nxdoxtVP/Ar+LD65mj3vkk4 ZgjGX9Qu706Aq3Np22dO40LgR4OLW9TIJ+DtnAPRKXW9wqcQgLCfTaOMNhJjvzIz75z5 mCuukswmC2aY4O/08b43ge0MkyzZCWMV3pbg79GMg1eR2b55uO9GxKmvWpp8BfI3phs6 zpZnFbx8JOhSovtXDIgbhTGDIzGDjPHoWTYeZVTwR1qSvpRyOH1hS+M6/vZcbgjGFU3N Cu/+hVFRJAyVGGdkkEwAnITgjbnGKY6mk6LoEfH4+ZnftA3klSuEDl+pSvilfjpErB+D onlg== X-Gm-Message-State: AOAM531RQ9MUydW2s1+8RgSZdit59k24C3mbmMrp2/rTRtIged4MOrwT WuVZ8sa/FmKJmpUhi+I+fRIIlZ6Yy7ApfiBV X-Google-Smtp-Source: ABdhPJyZ4TdDSdtcKdctANYz2LvB5uup2WCaAWqlr4bwKaNwCZSjdAQsTWE6GYB4uImZWeaySXjv3w== X-Received: by 2002:a17:90a:d786:b0:1b8:bd2a:d804 with SMTP id z6-20020a17090ad78600b001b8bd2ad804mr15034387pju.245.1645318304127; Sat, 19 Feb 2022 16:51:44 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f7sm8129695pfc.0.2022.02.19.16.51.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 16:51:43 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v2 1/7] cocci/nullfree: add more functions Date: Sat, 19 Feb 2022 16:51:34 -0800 Message-Id: <20220220005140.78713-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220220005140.78713-1-stephen@networkplumber.org> References: <20220219234322.61309-1-stephen@networkplumber.org> <20220220005140.78713-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 There are more functions in DPDK which have the semantics as free() when passed NULL pointer. Also, put the checks in alpha order. Signed-off-by: Stephen Hemminger --- devtools/cocci/nullfree.cocci | 63 +++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/devtools/cocci/nullfree.cocci b/devtools/cocci/nullfree.cocci index 363b6149ac28..a1e6be4b3b14 100644 --- a/devtools/cocci/nullfree.cocci +++ b/devtools/cocci/nullfree.cocci @@ -7,27 +7,78 @@ expression E; @@ ( +- if (E != NULL) cmdline_free(E); ++ cmdline_free(E); +| - if (E != NULL) free(E); + free(E); | +- if (E != NULL) rte_acl_free(E); ++ rte_acl_free(E); +| - if (E != NULL) rte_bitmap_free(E); + rte_bitmap_free(E); | +- if (E != NULL) rte_comp_op_free(E); ++ rte_comp_op_free(E); +| +- if (E != NULL) rte_crypto_op_free(E); ++ rte_crypto_op_free(E); +| +- if (E != NULL) rte_efd_free(E); ++ rte_efd_free(E); +| +- if (E != NULL) rte_event_ring_free(E); ++ rte_event_ring_free(E); +| - if (E != NULL) rte_free(E); + rte_free(E); | +- if (E != NULL) rte_fbk_hash_free(E); ++ rte_fbk_hash_free(E); +| +- if (E != NULL) rte_gpu_mem_free(E); ++ rte_gpu_mem_free(E); +| - if (E != NULL) rte_hash_free(E); + rte_hash_free(E); | -- if (E != NULL) rte_ring_free(E); -+ rte_ring_free(E); +- if (E != NULL) rte_intr_instance_free(E); ++ rte_intr_instance_free(E); | -- if (E != NULL) rte_pktmbuf_free(E); -+ rte_pktmbuf_free(E); +- if (E != NULL) rte_intr_vec_list_free(E); ++ rte_intr_vec_list_free(E); +| +- if (E != NULL) rte_kvargs_free(E); ++ rte_kvargs_free(E); +| +- if (E != NULL) rte_lpm_free(E); ++ rte_lpm_free(E); +| +- if (E != NULL) rte_lpm6_free(E); ++ rte_lpm6_free(E); +| +- if (E != NULL) rte_member_free(E); ++ rte_member_free(E); | - if (E != NULL) rte_mempool_free(E); + rte_mempool_free(E); | -- if (E != NULL) rte_kvargs_free(E); -+ rte_kvargs_free(E); +- if (E != NULL) rte_pktmbuf_free(E); ++ rte_pktmbuf_free(E); +| +- if (E != NULL) rte_rib_free(E); ++ rte_rib_free(E); +| +- if (E != NULL) rte_rib6_free(E); ++ rte_rib6_free(E); +| +- if (E != NULL) rte_ring_free(E); ++ rte_ring_free(E); +| +- if (E != NULL) rte_stack_free(E); ++ rte_stack_free(E); +| +- if (E != NULL) rte_tel_data_free(E); ++ rte_tel_data_free(E); ) From patchwork Sun Feb 20 00:51:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 107851 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 AA168A00C2; Sun, 20 Feb 2022 01:51:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE1234114A; Sun, 20 Feb 2022 01:51:49 +0100 (CET) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by mails.dpdk.org (Postfix) with ESMTP id 9284F410FA for ; Sun, 20 Feb 2022 01:51:46 +0100 (CET) Received: by mail-pf1-f181.google.com with SMTP id y11so5495174pfa.6 for ; Sat, 19 Feb 2022 16:51:46 -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=Q1rfFuy7cjfKewQwHuGQMrYytPjTVfBBJ2JNwLdtTUg=; b=53CoHJyLjYlG7I1seb/eB4I35oWbMKh5rP4Ydzd4s4Ic5WR0yMxJF315nbIcMQGhj+ QJ3+XeKl+uCdl5i0plnwM1ETq6/2fCmRBCzI+CF3Y4FJAMd31wmfKgEfOiD6p2hQbtNp i4hkldlq8McjaJvKa3OROB8UD6fwSO6Kd/ELmG21PG/mbzrfSmQX9Eq0Zx7Hq/CRrpx6 IAMTYyriNdnbbW0SwcMHRyHXVv9hErj38MlVZY2g5FRF2kPkfJCw7oN38ITE3R+5iyYk hfBN4lxaplKAW1WfRD9Xnaczl3uuQtAAH2wuxcLb+2TB03PiKb5XwG0q4t7vfLw5s4Yx GRKw== 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=Q1rfFuy7cjfKewQwHuGQMrYytPjTVfBBJ2JNwLdtTUg=; b=E6Dw+1mYShrHixSefRJIqo4NbjOK0dhAk5nqdmocHbDF2/u9oVnWdlCtqA04MQvTdg uqiW1Pljy0Fh+4miWjOEo3LY1LyncMvaZz5j5bjTTL8yhD7QPEOunWclyrspDCCHQXWw I5OkQcklXpf/vP87DVui03vdAV1HPMgNC4Yedmu/YZzjCa94yP3ChqcrNCpyMhradYFp jlb/6dDBcJN3HsEmYb+vN3CMgqPzeDFCW0urn0XzJS71vcFCRTtx9sUEf0/pE0zPcDjZ +oUC+WKUrxVK6f7QQ5F91wiZbzl4z0rsfTmQd0XDEN4uOA9vHT6U/sHgU0lKLcfyor5v /IMg== X-Gm-Message-State: AOAM531e2PSBgdvBormEzs120D1ktBzvscU5tpZBr3YeNOQFUPtemNBs SoXMBOuRHNp8HOVYtXlUO6j8i7TA89rC/TWl X-Google-Smtp-Source: ABdhPJwv/PpX3uohlJo3ib1zIMrleCUO/DBBxyJZK7jnfJMToN5vo/weYYj94xEQtXk/wXoY+YhHVA== X-Received: by 2002:aa7:88cb:0:b0:4df:7b9e:1cc3 with SMTP id k11-20020aa788cb000000b004df7b9e1cc3mr14387610pff.82.1645318305535; Sat, 19 Feb 2022 16:51:45 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f7sm8129695pfc.0.2022.02.19.16.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 16:51:44 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Konstantin Ananyev , Cristian Dumitrescu Subject: [PATCH v2 2/7] acl: remove unnecessary null checks Date: Sat, 19 Feb 2022 16:51:35 -0800 Message-Id: <20220220005140.78713-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220220005140.78713-1-stephen@networkplumber.org> References: <20220219234322.61309-1-stephen@networkplumber.org> <20220220005140.78713-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 This function already handles NULL as valid input. Signed-off-by: Stephen Hemminger --- app/test/test_acl.c | 12 ++++-------- lib/acl/rte_acl.h | 1 + lib/table/rte_swx_table_wm.c | 3 +-- lib/table/rte_table_acl.c | 15 +++++---------- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/app/test/test_acl.c b/app/test/test_acl.c index 4d51098925c4..623f34682e69 100644 --- a/app/test/test_acl.c +++ b/app/test/test_acl.c @@ -1171,8 +1171,7 @@ test_create_find_add(void) printf("Line %i: Creating context with existing name " "test failed!\n", __LINE__); - if (tmp) - rte_acl_free(tmp); + rte_acl_free(tmp); goto err; } @@ -1182,8 +1181,7 @@ test_create_find_add(void) printf("Line %i: Creating context with existing " "name test 2 failed!\n", __LINE__); - if (tmp) - rte_acl_free(tmp); + rte_acl_free(tmp); goto err; } @@ -1191,16 +1189,14 @@ test_create_find_add(void) tmp = rte_acl_find_existing(acx_name); if (tmp != acx) { printf("Line %i: Finding %s failed!\n", __LINE__, acx_name); - if (tmp) - rte_acl_free(tmp); + rte_acl_free(tmp); goto err; } tmp = rte_acl_find_existing(acx2_name); if (tmp != acx2) { printf("Line %i: Finding %s failed!\n", __LINE__, acx2_name); - if (tmp) - rte_acl_free(tmp); + rte_acl_free(tmp); goto err; } diff --git a/lib/acl/rte_acl.h b/lib/acl/rte_acl.h index f7f5f0870122..c33a688433b1 100644 --- a/lib/acl/rte_acl.h +++ b/lib/acl/rte_acl.h @@ -165,6 +165,7 @@ rte_acl_find_existing(const char *name); * * @param ctx * ACL context to free + * If NULL then, the function does nothing. */ void rte_acl_free(struct rte_acl_ctx *ctx); diff --git a/lib/table/rte_swx_table_wm.c b/lib/table/rte_swx_table_wm.c index e260be106221..c9d42a855249 100644 --- a/lib/table/rte_swx_table_wm.c +++ b/lib/table/rte_swx_table_wm.c @@ -375,8 +375,7 @@ table_free(void *table) if (!t) return; - if (t->acl_ctx) - rte_acl_free(t->acl_ctx); + rte_acl_free(t->acl_ctx); env_free(t, t->total_size); } diff --git a/lib/table/rte_table_acl.c b/lib/table/rte_table_acl.c index 14d54019f0bb..d15f03448796 100644 --- a/lib/table/rte_table_acl.c +++ b/lib/table/rte_table_acl.c @@ -148,8 +148,7 @@ rte_table_acl_free(void *table) } /* Free previously allocated resources */ - if (acl->ctx != NULL) - rte_acl_free(acl->ctx); + rte_acl_free(acl->ctx); rte_free(acl); @@ -320,8 +319,7 @@ rte_table_acl_entry_add( } /* Commit changes */ - if (acl->ctx != NULL) - rte_acl_free(acl->ctx); + rte_acl_free(acl->ctx); acl->ctx = ctx; *key_found = 0; *entry_ptr = &acl->memory[free_pos * acl->entry_size]; @@ -400,8 +398,7 @@ rte_table_acl_entry_delete( } /* Commit changes */ - if (acl->ctx != NULL) - rte_acl_free(acl->ctx); + rte_acl_free(acl->ctx); acl->ctx = ctx; *key_found = 1; @@ -577,8 +574,7 @@ rte_table_acl_entry_add_bulk( } /* Commit changes */ - if (acl->ctx != NULL) - rte_acl_free(acl->ctx); + rte_acl_free(acl->ctx); acl->ctx = ctx; for (i = 0; i < n_keys; i++) { @@ -696,8 +692,7 @@ rte_table_acl_entry_delete_bulk( } /* Commit changes */ - if (acl->ctx != NULL) - rte_acl_free(acl->ctx); + rte_acl_free(acl->ctx); acl->ctx = ctx; for (i = 0; i < n_keys; i++) { From patchwork Sun Feb 20 00:51:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 107852 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 EBCDDA00C2; Sun, 20 Feb 2022 01:52:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EAC7F41152; Sun, 20 Feb 2022 01:51:50 +0100 (CET) Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by mails.dpdk.org (Postfix) with ESMTP id 11A24410FA for ; Sun, 20 Feb 2022 01:51:48 +0100 (CET) Received: by mail-pj1-f51.google.com with SMTP id q11-20020a17090a304b00b001b94d25eaecso11891452pjl.4 for ; Sat, 19 Feb 2022 16:51:47 -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=HP50AnJLQFaAeX74twilP1G6y4PxcwD69EyDyAwScTU=; b=1aUSokUEO0sBneFQG0CMVciDsbKObkKrcvCMPScgfG7oFEONr63j6RgU9OaZPWeuJC 2EBj5KTNwRYzZ96jcrrdKnuihJelzj1dj7kBlJRYaRrGmaHFaeEvgLYsMd/HEgwSrUbq GpHEWuaPo9+lAR0qrjOtxk48mpSyaFdcbxLEBSqOu8vx+F5PMoYK/WiYJ38UX4AR1rIW dm8gSe5UGCbn17BLuTK40sqO8SVCWvlZfnZ0YrBoNgzWgUjCjUK0oxffflk14TYHgLJA ED8Yf+QYKoyjgeF/Aox+f3Yicd7mlzt8Sltfh7sDZSzczJk7t398E3kFUdn8YlPj2DXh iWtg== 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=HP50AnJLQFaAeX74twilP1G6y4PxcwD69EyDyAwScTU=; b=bCTcHT7MCoqO2/cz91HjHSnodh8kjYlvSCbIZc7YgmQUtjC1a36nKn+DNR74E2Hc1P YHN1MCn++e85yvXEAJEwIG09KUMArSvONMCR7OYILTSmq5B2AgBnYtsZkDUsl3kfTHxP g5QjLTxs1biY8GujOEpqAEON099HxBWuHmgU3uQsxQxssa6IaUtXwxj02/Lva7ErJ2J5 qf+FjHMeluVMT8fA6jBDGa/WPiGPTQEVZtFgc8NUzNjKdGyxGiiCV65fRuBw1SAIdRB5 kf5jfeCDItfQ9sbPdWmnVtyj5Ef8dOl0iZl1zwZNcVyg1u6RZZ20qRvw7sfGvSxcKUSR iPUA== X-Gm-Message-State: AOAM532dZzsBvejERYoR5CLNuvnVsrMeaCXFCiIkiP6wFTqnWD5/F89j CLwfSqyKYLNMoJbexBuYIRK4LzZi3FN2LW2O X-Google-Smtp-Source: ABdhPJw9j3QXM28Jp+gEn2VO5JqGUhYx1imZjQnz5w0KpUbjGP+HrPMXhHDN4e/1oSbddtQIXhl5jA== X-Received: by 2002:a17:90a:9309:b0:1bc:1bf1:dad4 with SMTP id p9-20020a17090a930900b001bc1bf1dad4mr1799732pjo.169.1645318306904; Sat, 19 Feb 2022 16:51:46 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f7sm8129695pfc.0.2022.02.19.16.51.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 16:51:46 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Bruce Richardson , Vladimir Medvedkin , Anatoly Burakov , Olivier Matz , Andrew Rybchenko , Yipeng Wang , Sameh Gobriel , Honnappa Nagarahalli , Konstantin Ananyev Subject: [PATCH v2 3/7] lpm: remove unnecessary NULL checks Date: Sat, 19 Feb 2022 16:51:36 -0800 Message-Id: <20220220005140.78713-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220220005140.78713-1-stephen@networkplumber.org> References: <20220219234322.61309-1-stephen@networkplumber.org> <20220220005140.78713-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 The functions rte_lpm_free() and rte_lpm6_free() already handle NULL pointer case. Signed-off-by: Stephen Hemminger --- app/test/test_func_reentrancy.c | 3 +-- lib/lpm/rte_lpm.h | 1 + lib/lpm/rte_lpm6.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c index da00694daafd..67e69ad53588 100644 --- a/app/test/test_func_reentrancy.c +++ b/app/test/test_func_reentrancy.c @@ -348,8 +348,7 @@ lpm_clean(unsigned int lcore_id) int i; lpm = rte_lpm_find_existing("fr_test_once"); - if (lpm != NULL) - rte_lpm_free(lpm); + rte_lpm_free(lpm); for (i = 0; i < MAX_LPM_ITER_TIMES; i++) { snprintf(lpm_name, sizeof(lpm_name), "fr_test_%d_%d", lcore_id, i); diff --git a/lib/lpm/rte_lpm.h b/lib/lpm/rte_lpm.h index 5eb14c1748e5..a50bf3339fee 100644 --- a/lib/lpm/rte_lpm.h +++ b/lib/lpm/rte_lpm.h @@ -183,6 +183,7 @@ rte_lpm_find_existing(const char *name); * * @param lpm * LPM object handle + * If NULL then, the function does nothing. * @return * None */ diff --git a/lib/lpm/rte_lpm6.h b/lib/lpm/rte_lpm6.h index f96f3372e593..145fd4495a94 100644 --- a/lib/lpm/rte_lpm6.h +++ b/lib/lpm/rte_lpm6.h @@ -73,6 +73,7 @@ rte_lpm6_find_existing(const char *name); * * @param lpm * LPM object handle + * If NULL then, the function does nothing. * @return * None */ From patchwork Sun Feb 20 00:51:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 107853 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 BBCF4A00C2; Sun, 20 Feb 2022 01:52:07 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 16D6441157; Sun, 20 Feb 2022 01:51:53 +0100 (CET) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by mails.dpdk.org (Postfix) with ESMTP id 771FD41147 for ; Sun, 20 Feb 2022 01:51:49 +0100 (CET) Received: by mail-pl1-f172.google.com with SMTP id z2so1403053plg.8 for ; Sat, 19 Feb 2022 16:51:49 -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=bWbhdn5YZ1cHnXbTN7Kx9VJoW39NJkYUfErisW629FY=; b=EG2U2HSrSDq57gs+w/A5w6U6qa7ZqNSlhJqvQOBSt4ByEzSkZR9hQBwg7nD4S0xnHl xKh9ftuPfllVYQjMMC7nKpRR+exxcQnMN/6pcyCJObbCvEvw/YQOqzVby6Lz8twyUdNh 3hxYp94Ksc3XaSEAx4r5xW8JL3DUib9oA1Nn+aKgflJhwCLkFERz43p1L1YJQ75QzsPc PSi6vuhfGgquUOUXefTJRPLACvTGkgTzbOdQ5SLUPeAwM4XVwcDo0Yksz0v4NU1g5aUF IhpsA+H2K9KoKK3dvSwpFnNLhHVZCWkEds2ovaqWe1gIKUVYwBiPaMkwa+WOx1wUz8Mh ftlA== 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=bWbhdn5YZ1cHnXbTN7Kx9VJoW39NJkYUfErisW629FY=; b=HN5pWpUwDT+y4Zbnt/eF3rJo9tKWi75sBAQ706VH1zleEkiblOAZxGqbmeU4lcLtor NdwXVKc5OB8S+h3y5C7JcPg++Z/b+o+313UjiR9goICrxcfhpXdSGA3PCSysr+leFl1I XT3O6R7MaQ+GcrMTUptHriC7hrOP+/xtODkDhNs79xSp8wm92vnnn4bqG/pJ2AygGHZm 15NhYsyZWJLAbPE5kFbTB0M0zbqQ/N2gnNqGW2pjarWbrPVu/Lg+EOlWcdga9jebeUeR 50T30uG+WntLPa6bOyx//ZvLkhXIVXxq21UKNQqBOcen8wK6v3KF/DirFm4PJhQyvYR5 HLzw== X-Gm-Message-State: AOAM530Hps++LmU2gpsrSOKC09TXuCvnPRbCL5anDKgmuYFDYsrCjf4f Y14iT1NIQ8ZGLXPYqXJAe/zynifJp5MwDtUJ X-Google-Smtp-Source: ABdhPJzyq/2Kd0cnPcsGFply0ZI+j2bRsZXWST6gFN4EEyU7gWen4Cx+gnF8ADiuLWokkPNmEv/V5A== X-Received: by 2002:a17:90a:db92:b0:1bc:1670:2aff with SMTP id h18-20020a17090adb9200b001bc16702affmr2379536pjv.8.1645318308345; Sat, 19 Feb 2022 16:51:48 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f7sm8129695pfc.0.2022.02.19.16.51.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 16:51:47 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Fan Zhang , Ashish Gupta , Akhil Goyal , Harman Kalra , Byron Marohn , Yipeng Wang , Jerin Jacob , Sameh Gobriel , Vladimir Medvedkin , Olivier Matz , Ciara Power Subject: [PATCH v2 4/7] lib: document existing free functions Date: Sat, 19 Feb 2022 16:51:37 -0800 Message-Id: <20220220005140.78713-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220220005140.78713-1-stephen@networkplumber.org> References: <20220219234322.61309-1-stephen@networkplumber.org> <20220220005140.78713-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 These functions all accept NULL as parameter. Signed-off-by: Stephen Hemminger --- lib/compressdev/rte_comp.h | 1 + lib/cryptodev/rte_crypto.h | 1 + lib/eal/include/rte_interrupts.h | 4 +++- lib/efd/rte_efd.h | 1 + lib/eventdev/rte_event_ring.h | 1 + lib/member/rte_member.h | 1 + lib/rib/rte_rib.h | 1 + lib/rib/rte_rib6.h | 1 + lib/stack/rte_stack.h | 1 + lib/telemetry/rte_telemetry.h | 2 +- 10 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/compressdev/rte_comp.h b/lib/compressdev/rte_comp.h index 95306c5d0364..b07434ad39b2 100644 --- a/lib/compressdev/rte_comp.h +++ b/lib/compressdev/rte_comp.h @@ -471,6 +471,7 @@ rte_comp_op_bulk_alloc(struct rte_mempool *mempool, * * @param op * Compress operation + * If NULL then, the function does nothing. */ __rte_experimental void diff --git a/lib/cryptodev/rte_crypto.h b/lib/cryptodev/rte_crypto.h index a864f5036f3a..326764b0f0c0 100644 --- a/lib/cryptodev/rte_crypto.h +++ b/lib/cryptodev/rte_crypto.h @@ -339,6 +339,7 @@ __rte_crypto_op_get_priv_data(struct rte_crypto_op *op, uint32_t size) * be returned to the mempool. * * @param op symmetric crypto operation + * If NULL then, the function does nothing. */ static inline void rte_crypto_op_free(struct rte_crypto_op *op) diff --git a/lib/eal/include/rte_interrupts.h b/lib/eal/include/rte_interrupts.h index edbf0faeeffd..3ef8ab4621fb 100644 --- a/lib/eal/include/rte_interrupts.h +++ b/lib/eal/include/rte_interrupts.h @@ -243,7 +243,8 @@ rte_intr_instance_alloc(uint32_t flags); * resources. * * @param intr_handle - * Interrupt handle address. + * Interrupt handle address. + * If NULL then, the function does nothing. * */ __rte_experimental @@ -746,6 +747,7 @@ rte_intr_vec_list_index_get(const struct rte_intr_handle *intr_handle, * * @param intr_handle * pointer to the interrupt handle. + * If NULL then, the function does nothing. * * @return * - On success, zero diff --git a/lib/efd/rte_efd.h b/lib/efd/rte_efd.h index d3d7befd0c90..afba38a78c8a 100644 --- a/lib/efd/rte_efd.h +++ b/lib/efd/rte_efd.h @@ -146,6 +146,7 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len, * * @param table * Table to free + * If NULL then, the function does nothing. */ void rte_efd_free(struct rte_efd_table *table); diff --git a/lib/eventdev/rte_event_ring.h b/lib/eventdev/rte_event_ring.h index c0861b0ec2db..85c214a678cd 100644 --- a/lib/eventdev/rte_event_ring.h +++ b/lib/eventdev/rte_event_ring.h @@ -233,6 +233,7 @@ rte_event_ring_lookup(const char *name); * * @param r * Ring to free + * If NULL then, the function does nothing. */ void rte_event_ring_free(struct rte_event_ring *r); diff --git a/lib/member/rte_member.h b/lib/member/rte_member.h index c0689e233e65..ada3b96e5ec1 100644 --- a/lib/member/rte_member.h +++ b/lib/member/rte_member.h @@ -444,6 +444,7 @@ rte_member_add(const struct rte_member_setsum *setsum, const void *key, * * @param setsum * Pointer to the set summary. + * If NULL then, the function does nothing. */ void rte_member_free(struct rte_member_setsum *setsum); diff --git a/lib/rib/rte_rib.h b/lib/rib/rte_rib.h index bebb30f7d7cf..bafd2585ac69 100644 --- a/lib/rib/rte_rib.h +++ b/lib/rib/rte_rib.h @@ -265,6 +265,7 @@ rte_rib_find_existing(const char *name); * * @param rib * RIB object handle + * If NULL then, the function does nothing. * @return * None */ diff --git a/lib/rib/rte_rib6.h b/lib/rib/rte_rib6.h index 6f532265c657..a2e179ccb4b9 100644 --- a/lib/rib/rte_rib6.h +++ b/lib/rib/rte_rib6.h @@ -320,6 +320,7 @@ rte_rib6_find_existing(const char *name); * * @param rib * RIB object handle + * If NULL then, the function does nothing. * @return * None */ diff --git a/lib/stack/rte_stack.h b/lib/stack/rte_stack.h index 321f4cec1a10..8c3bd4862711 100644 --- a/lib/stack/rte_stack.h +++ b/lib/stack/rte_stack.h @@ -215,6 +215,7 @@ rte_stack_create(const char *name, unsigned int count, int socket_id, * * @param s * Stack to free + * If NULL then, the function does nothing. */ void rte_stack_free(struct rte_stack *s); diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h index 7bca8a9a49e2..af95fb4f150b 100644 --- a/lib/telemetry/rte_telemetry.h +++ b/lib/telemetry/rte_telemetry.h @@ -289,7 +289,7 @@ rte_tel_data_alloc(void); * * @param data * Pointer to container. - *. + * If NULL then, the function does nothing. */ void rte_tel_data_free(struct rte_tel_data *data); From patchwork Sun Feb 20 00:51:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 107854 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 AB3D0A00C2; Sun, 20 Feb 2022 01:52:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 207234115A; Sun, 20 Feb 2022 01:51:54 +0100 (CET) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by mails.dpdk.org (Postfix) with ESMTP id DA95441150 for ; Sun, 20 Feb 2022 01:51:50 +0100 (CET) Received: by mail-pl1-f172.google.com with SMTP id m11so6495276pls.5 for ; Sat, 19 Feb 2022 16:51:50 -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=4GNWOCeECk4W5dvSei/2YWeZW1DAhQYhmlSYIkWYJgY=; b=FqDZH4COVdZ1Vta2yZ8LXV/1plXfxYwC+L41vm916btPiuHhmFvJgXxjoBMBFCufai Y2kdffxB38YkdU5G61qZVGR45XJVj670VGDwhdovRmeuYQtFD95241Dz5jj6cwfHvpGU z5tYa5B/QOKFlEVwojWy6URVSyj+Sq4Tk6ZwPyTGWVQbKywmL6QSVyB5ajK2c7SJdmsE x+TySPB2Rg3Mfv8H1ARrzqtVoQKU1T2ExPd38DmV6arUvYOSSvF+4pPLYzU/XkSWSIJw iuED3fUca1mbj2P5bAB/U36Bx8EUF+SkyMgNk2uETJ7P3x3JhDamPEnO11GFcyjEpLV+ asIQ== 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=4GNWOCeECk4W5dvSei/2YWeZW1DAhQYhmlSYIkWYJgY=; b=nNttPiocrXcmApZNP8ZkakVkAo6qYUITgw7TK7QiYSyi1g2No2gg+lV4CWKGE7SxTJ s85IXZ84HyTT0pCr5dWiJKjVjmekE2+X/ZQ/t+GobeBWtEKC+H/ViJ99LGzfjcdjwX/5 Dp1KLKxWTu1gCZ87gniZOYJSjOSLVrZ/VmpyaFAGhIlh/duVrve+OW6BFlPeMGCHzC1P HynklDdkukSrkBd9b/oxc2Kxw2YlpqWUqldBWTBTdHbePtBlg9SDluak8o42VaF95BCW wZabvMOWtj4xDC5nhHTW/5M0hW1Ee21gVpEuHLJxK9h+8Ejo/zl3hbeNFR3zJALCeMKN q38Q== X-Gm-Message-State: AOAM531/EUjqQGCyde8NWwEqHwLC4Dsm9KhF0iGKud29C65Cqzs9B9H4 eUa5n2Hpr1WBRJv2AD9Hd5TPL3sNtGfSBbq+ X-Google-Smtp-Source: ABdhPJz9J8LhE4yMy9sh3xAEiSFeVGaysgsFx9+KDKkyN4CZtlPnitSauSLgObmpBqjc4UUnSKZCWw== X-Received: by 2002:a17:902:e74d:b0:14f:206d:1860 with SMTP id p13-20020a170902e74d00b0014f206d1860mr13664166plf.59.1645318309720; Sat, 19 Feb 2022 16:51:49 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f7sm8129695pfc.0.2022.02.19.16.51.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 16:51:49 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Olivier Matz , Akhil Goyal , Fan Zhang , Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin , Andrew Rybchenko , Honnappa Nagarahalli , Konstantin Ananyev , Anatoly Burakov Subject: [PATCH v2 5/7] test: remove unecessary NULL checks before free Date: Sat, 19 Feb 2022 16:51:38 -0800 Message-Id: <20220220005140.78713-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220220005140.78713-1-stephen@networkplumber.org> References: <20220219234322.61309-1-stephen@networkplumber.org> <20220220005140.78713-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 These are all cases in test code where there is unnecessary NULL check before free caught by coccinelle nullfree script. Signed-off-by: Stephen Hemminger --- app/test/test_cmdline_lib.c | 3 +-- app/test/test_cryptodev.c | 9 +++----- app/test/test_cryptodev_asym.c | 30 +++++++++------------------ app/test/test_cryptodev_blockcipher.c | 3 +-- app/test/test_func_reentrancy.c | 3 +-- app/test/test_hash.c | 3 +-- 6 files changed, 17 insertions(+), 34 deletions(-) diff --git a/app/test/test_cmdline_lib.c b/app/test/test_cmdline_lib.c index fcd58cb76af1..87c105936650 100644 --- a/app/test/test_cmdline_lib.c +++ b/app/test/test_cmdline_lib.c @@ -229,8 +229,7 @@ test_cmdline_fns(void) error: printf("Error: function accepted null parameter!\n"); - if (cl != NULL) - cmdline_free(cl); + cmdline_free(cl); return -1; } diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index a63c199964d4..1d9f615255c4 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1451,8 +1451,7 @@ ut_teardown(void) } /* free crypto operation structure */ - if (ut_params->op) - rte_crypto_op_free(ut_params->op); + rte_crypto_op_free(ut_params->op); /* * free mbuf - both obuf and ibuf are usually the same, @@ -11653,8 +11652,7 @@ test_multi_session(void) aes_cbc_iv), "Failed to perform decrypt on request number %u.", i); /* free crypto operation structure */ - if (ut_params->op) - rte_crypto_op_free(ut_params->op); + rte_crypto_op_free(ut_params->op); /* * free mbuf - both obuf and ibuf are usually the same, @@ -11797,8 +11795,7 @@ test_multi_session_random_usage(void) ut_paramz[j].iv), "Failed to perform decrypt on request number %u.", i); - if (ut_paramz[j].ut_params.op) - rte_crypto_op_free(ut_paramz[j].ut_params.op); + rte_crypto_op_free(ut_paramz[j].ut_params.op); /* * free mbuf - both obuf and ibuf are usually the same, diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c index 7cda8bb081f0..9b4d9db59297 100644 --- a/app/test/test_cryptodev_asym.c +++ b/app/test/test_cryptodev_asym.c @@ -507,8 +507,7 @@ test_cryptodev_asym_op(struct crypto_testsuite_params_asym *ts_params, if (sess != NULL) rte_cryptodev_asym_session_free(dev_id, sess); - if (op != NULL) - rte_crypto_op_free(op); + rte_crypto_op_free(op); rte_free(result); @@ -1114,8 +1113,7 @@ test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm) error_exit: if (sess != NULL) rte_cryptodev_asym_session_free(dev_id, sess); - if (op != NULL) - rte_crypto_op_free(op); + rte_crypto_op_free(op); return status; } @@ -1193,8 +1191,7 @@ test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm) error_exit: if (sess != NULL) rte_cryptodev_asym_session_free(dev_id, sess); - if (op != NULL) - rte_crypto_op_free(op); + rte_crypto_op_free(op); return status; } @@ -1283,8 +1280,7 @@ test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm) error_exit: if (sess != NULL) rte_cryptodev_asym_session_free(dev_id, sess); - if (op != NULL) - rte_crypto_op_free(op); + rte_crypto_op_free(op); return status; } @@ -1370,8 +1366,7 @@ test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm) error_exit: if (sess != NULL) rte_cryptodev_asym_session_free(dev_id, sess); - if (op != NULL) - rte_crypto_op_free(op); + rte_crypto_op_free(op); return status; } @@ -1481,8 +1476,7 @@ test_mod_inv(void) if (sess) rte_cryptodev_asym_session_free(dev_id, sess); - if (op) - rte_crypto_op_free(op); + rte_crypto_op_free(op); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1593,8 +1587,7 @@ test_mod_exp(void) if (sess != NULL) rte_cryptodev_asym_session_free(dev_id, sess); - if (op != NULL) - rte_crypto_op_free(op); + rte_crypto_op_free(op); TEST_ASSERT_EQUAL(status, 0, "Test failed"); @@ -1758,8 +1751,7 @@ test_dsa_sign(void) error_exit: if (sess != NULL) rte_cryptodev_asym_session_free(dev_id, sess); - if (op != NULL) - rte_crypto_op_free(op); + rte_crypto_op_free(op); return status; } @@ -1947,8 +1939,7 @@ test_ecdsa_sign_verify(enum curve curve_id) exit: if (sess != NULL) rte_cryptodev_asym_session_free(dev_id, sess); - if (op != NULL) - rte_crypto_op_free(op); + rte_crypto_op_free(op); return status; }; @@ -2109,8 +2100,7 @@ test_ecpm(enum curve curve_id) exit: if (sess != NULL) rte_cryptodev_asym_session_free(dev_id, sess); - if (op != NULL) - rte_crypto_op_free(op); + rte_crypto_op_free(op); return status; } diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c index 494459195c49..954587ea5b18 100644 --- a/app/test/test_cryptodev_blockcipher.c +++ b/app/test/test_cryptodev_blockcipher.c @@ -811,8 +811,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, rte_free(auth_xform); } - if (op) - rte_crypto_op_free(op); + rte_crypto_op_free(op); rte_pktmbuf_free(obuf); diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c index 67e69ad53588..d1ed5d4abcfc 100644 --- a/app/test/test_func_reentrancy.c +++ b/app/test/test_func_reentrancy.c @@ -278,8 +278,7 @@ fbk_clean(unsigned lcore_id) int i; handle = rte_fbk_hash_find_existing("fr_test_once"); - if (handle != NULL) - rte_fbk_hash_free(handle); + rte_fbk_hash_free(handle); for (i = 0; i < MAX_ITER_MULTI; i++) { snprintf(fbk_name, sizeof(fbk_name), "fr_test_%d_%d", lcore_id, i); diff --git a/app/test/test_hash.c b/app/test/test_hash.c index d522cb7f8cbf..3e45afaa67fc 100644 --- a/app/test/test_hash.c +++ b/app/test/test_hash.c @@ -1159,8 +1159,7 @@ fbk_hash_unit_test(void) RETURN_IF_ERROR_FBK(handle == NULL, "fbk hash creation should have succeeded"); tmp = rte_fbk_hash_create(&invalid_params_same_name_2); - if (tmp != NULL) - rte_fbk_hash_free(tmp); + rte_fbk_hash_free(tmp); RETURN_IF_ERROR_FBK(tmp != NULL, "fbk hash creation should have failed"); /* we are not freeing handle here because we need a hash list From patchwork Sun Feb 20 00:51:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 107855 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 BCBA1A00C2; Sun, 20 Feb 2022 01:52:18 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F06F541169; Sun, 20 Feb 2022 01:51:55 +0100 (CET) Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by mails.dpdk.org (Postfix) with ESMTP id A774E41155 for ; Sun, 20 Feb 2022 01:51:51 +0100 (CET) Received: by mail-pj1-f49.google.com with SMTP id gi6so2157576pjb.1 for ; Sat, 19 Feb 2022 16:51:51 -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=PpwvHLHd9+fy62V9D2Gu0I2ntjXnX+NovVC5P1oK/eg=; b=qtk1JRwuEI0nxSagwJb8t0uw30g/lRTgKXrWDmP8hWwtM4NglMWtHybIUYFcwM4BGC NipfucaeXpTK+8bSYqriSGcwHHcCK73ldhW26cN15WbGZTIOYN168BxeJ3oRrKuN+T4n FD+y4sSh2sSoLh1+R118mYVsGRdFB3Hj/ZL9XgnVVZREH3VLY08plkSYbXdkHlETPHtI 8fbAEPoos0/WPycLLmulwS/a40TLtfcxZjQRSsM3OPFf4K7wtsdiw3REOGoj04sxI3DK vFR8g8kOeFiY21HPj+cF3RlvYhSCGeruyW3DtgPPo6qhZ3kOoDDp+Rd3fKgTuFxQoT6N IMSg== 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=PpwvHLHd9+fy62V9D2Gu0I2ntjXnX+NovVC5P1oK/eg=; b=pDsZaueXQIClLC2ryU30DmZ4n5wCrovy3EIhz1uA/ziMrFPoSb8DKDf00mnXU194ie 2B+menSdLorgQmed02X3vG05G4WglB0MAziGPhYG34lsU9JKwQfdDDDl6dpgSyFbJFAh ZaxSk8GapccxAydqCrXSmhIlIPmYlHQqfKTPQeIBkGAveEaI3Ef9G/Agh1ybZZsxHrmk q1lAYPVpjtOBx1rzUlAQNoP6MtA8+ZWGitLrIE0ljRNfrsjLN8nNoIJdAR8QC+rdRDd1 kWoCBoQ1CR1PVVzKEfmhW7dLWueRCxs9y3T27M7iyKD3XNcpTe62bkyY6TpTpJl8zFrv 01Mw== X-Gm-Message-State: AOAM53238R6oFit0CN6miQpDztPUfznYN5Mnws7e/tY705rUjRU0c6Zn 3KFvbWTxP0Ft8Stl7RiaYMRyrCuU/0CwQzf0 X-Google-Smtp-Source: ABdhPJzKe6r1OHq+0MYKjh2REUT5c+5SkubEN5Ze2k4VR9SlrZ/TSMU0zMvr9jb/cxa6UaA0tfYRyg== X-Received: by 2002:a17:90b:e89:b0:1b9:19d0:432c with SMTP id fv9-20020a17090b0e8900b001b919d0432cmr19081365pjb.154.1645318310794; Sat, 19 Feb 2022 16:51:50 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f7sm8129695pfc.0.2022.02.19.16.51.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 16:51:50 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Marko Kovacevic Subject: [PATCH v2 6/7] fips_validation: remove unnecessary NULL check Date: Sat, 19 Feb 2022 16:51:39 -0800 Message-Id: <20220220005140.78713-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220220005140.78713-1-stephen@networkplumber.org> References: <20220219234322.61309-1-stephen@networkplumber.org> <20220220005140.78713-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 here. Signed-off-by: Stephen Hemminger --- examples/fips_validation/fips_dev_self_test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/fips_validation/fips_dev_self_test.c b/examples/fips_validation/fips_dev_self_test.c index 076e9de099c0..19af134bbe83 100644 --- a/examples/fips_validation/fips_dev_self_test.c +++ b/examples/fips_validation/fips_dev_self_test.c @@ -1523,8 +1523,7 @@ fips_dev_auto_test_uninit(uint8_t dev_id, struct fips_dev_auto_test_env *env) { rte_pktmbuf_free(env->mbuf); - if (env->op) - rte_crypto_op_free(env->op); + rte_crypto_op_free(env->op); rte_mempool_free(env->mpool); rte_mempool_free(env->op_pool); rte_mempool_free(env->sess_pool); From patchwork Sun Feb 20 00:51:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 107856 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 B8468A00C2; Sun, 20 Feb 2022 01:52:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 009EE4116E; Sun, 20 Feb 2022 01:51:57 +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 0E29D41155 for ; Sun, 20 Feb 2022 01:51:53 +0100 (CET) Received: by mail-pj1-f52.google.com with SMTP id b8so11728033pjb.4 for ; Sat, 19 Feb 2022 16:51:52 -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=JmXi31/r8tlV/948CXLr7AjGfC9uW5LXdCV6pMs+g48=; b=f1Jl3Sf3FJRgg1nVw+WcdyHTuTMgvaEXYRIWGTwIKhbjKpuOUb983z9pRRHXBbiR0K Y4vXGYDoTVy0Khhgs4LNnUtqtsiYfNa+nWgqlbNkDCKysoLsF3jGyiRBMIYg0DWIBhwk uWIlYEe6GesSiZO3xV2m55UZLxG4YN9P9hhrdi7VPAv68bo8AzNwr4qX2p2AGg6bNMTD B0lXRtRn8B1piKXRUVroVcsKmw6/54i0kHoGInrcDpVbyDQfcz6Az3P2mJfL2sYoJSrq ervq/mgfVaPQAancoq2YNlUtz/krd/KarP+77lt2XNxdrD8U4T8WfbaTw7vMBCFCS3f9 Yk2Q== 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=JmXi31/r8tlV/948CXLr7AjGfC9uW5LXdCV6pMs+g48=; b=iT9ZLdoGqWq653QPufCGSoEiqGHtxfSZ7HFoA58eIlxutnedx9eWrqtXvM7qIvgS/E uJCjQ6Lcz8aieek8/OSUemI2604PZm3pavfzvLOKhK0D9rJeYptgTVDrQ7lwLBcOaSIB uF0x5061x/KP3HxcQPOZ4xhQ3RiEyzwf0tQQEF5RwDYv9LnBSt/C9jP0gSiiFAYlg5CL eUzsRibCEKDHISHc3WNkiGbvifrLiGAOt+HqgYYIdXJ427J1H8IQ/DIEbZx8LVptMNKu uwVUVjkWuhIoqZ7hp8n5/hubkivE4u7rTMAe2/Qn8KHFeJlLnJAn7h1h3+OtO7WiA4tb lhVw== X-Gm-Message-State: AOAM533sba8PXi5VcpwEKgxSvKl4LM9UjSrJ91+L819e8HMizhaDROK7 1IeA4IXpm5dcr/9HkQda01EX04wxf6Reh6Gm X-Google-Smtp-Source: ABdhPJx2OTGhvzTWcQGqlz4ugTkpnVGZSDgvqhv+RWHPnZGtXqdNnZOKWbhOKVPjn6Sq57H04v1fhQ== X-Received: by 2002:a17:902:8ec7:b0:14a:c442:8ca2 with SMTP id x7-20020a1709028ec700b0014ac4428ca2mr13459832plo.12.1645318311989; Sat, 19 Feb 2022 16:51:51 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f7sm8129695pfc.0.2022.02.19.16.51.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 16:51:51 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Harry van Haaren Subject: [PATCH v2 7/7] event/sw: remove unnecessary NULL check Date: Sat, 19 Feb 2022 16:51:40 -0800 Message-Id: <20220220005140.78713-8-stephen@networkplumber.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220220005140.78713-1-stephen@networkplumber.org> References: <20220219234322.61309-1-stephen@networkplumber.org> <20220220005140.78713-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 The rte_event_ring_free() function already handles NULL pointer. Signed-off-by: Stephen Hemminger --- drivers/event/sw/sw_evdev.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c index ba82a80385b6..f93313b31b5c 100644 --- a/drivers/event/sw/sw_evdev.c +++ b/drivers/event/sw/sw_evdev.c @@ -166,8 +166,7 @@ sw_port_setup(struct rte_eventdev *dev, uint8_t port_id, snprintf(buf, sizeof(buf), "sw%d_p%u_%s", dev->data->dev_id, port_id, "rx_worker_ring"); struct rte_event_ring *existing_ring = rte_event_ring_lookup(buf); - if (existing_ring) - rte_event_ring_free(existing_ring); + rte_event_ring_free(existing_ring); p->rx_worker_ring = rte_event_ring_create(buf, MAX_SW_PROD_Q_DEPTH, dev->data->socket_id, @@ -186,8 +185,7 @@ sw_port_setup(struct rte_eventdev *dev, uint8_t port_id, snprintf(buf, sizeof(buf), "sw%d_p%u, %s", dev->data->dev_id, port_id, "cq_worker_ring"); existing_ring = rte_event_ring_lookup(buf); - if (existing_ring) - rte_event_ring_free(existing_ring); + rte_event_ring_free(existing_ring); p->cq_worker_ring = rte_event_ring_create(buf, conf->dequeue_depth, dev->data->socket_id,