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 4936545F0A; Sun, 22 Dec 2024 02:34:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E4652402C5; Sun, 22 Dec 2024 02:34:01 +0100 (CET) Received: from smtp.eurecom.fr (smtp.eurecom.fr [193.55.113.210]) by mails.dpdk.org (Postfix) with ESMTP id 1609F40144; Sun, 22 Dec 2024 02:34:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=eurecom.fr; i=@eurecom.fr; q=dns/txt; s=default; t=1734831240; x=1766367240; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B4SGFZT67bBKI/Lmg61zvqru8uKb3xUAShUniw7BnA8=; b=yNv/97v1rp0ssdAtm0RoEp4NYFUFi53QPo+rXcpAMvHUibBiJ8+YoMyq j8xhClullnOOFWBLsfGgRW+MhKPD7/cxH8zItbW8VCZqPt2vzxsKAh6Ss DeWujTEObG2Z+Vdlp6etuFBIwA7+Fy1U5nRuHHJzg7AmUsjYRAzlsajYw s=; X-CSE-ConnectionGUID: CvEUPYrrTpyo0rYceCZg/Q== X-CSE-MsgGUID: 0WNu+kmTS/WDqKDsqefa3A== X-IronPort-AV: E=Sophos;i="6.12,254,1728943200"; d="scan'208";a="28289469" Received: from waha.eurecom.fr (HELO smtps.eurecom.fr) ([10.3.2.236]) by drago1i.eurecom.fr with ESMTP; 22 Dec 2024 02:33:59 +0100 Received: from localhost.localdomain (88-183-119-157.subs.proxad.net [88.183.119.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtps.eurecom.fr (Postfix) with ESMTPSA id BAFF92579; Sun, 22 Dec 2024 02:33:59 +0100 (CET) From: Ariel Otilibili To: dev@dpdk.org Cc: stable@dpdk.org, Ariel Otilibili , Andrew Boyer Subject: [PATCH v3 01/10] devtools/cocci, lib/eal: remove unused rte_bitmap_free() Date: Sun, 22 Dec 2024 02:19:53 +0100 Message-ID: <20241222013328.1362225-2-otilibil@eurecom.fr> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241222013328.1362225-1-otilibil@eurecom.fr> References: <20241222013328.1362225-1-otilibil@eurecom.fr> 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 Coverity reports return values of calls to rte_bitmap_free() are not used. As of commit 07604f2644 ("maintainers: update for next-net tree"): ``` $ awk 'NR>281 && NR<300 {print NR ":" $0}' lib/eal/include/rte_bitmap.h 282:/** 283: * Bitmap free 284: * 285: * @param bmp 286: * Handle to bitmap instance 287: * @return 288: * 0 upon success, error code otherwise 289: */ 290:static inline int 291:rte_bitmap_free(struct rte_bitmap *bmp) 292:{ 293: /* Check input arguments */ 294: if (bmp == NULL) { 295: return -1; 296: } 297: 298: return 0; 299:} ``` rte_bitmap_free() checks the pointer to its input rte_bitmap is not null, and does nothing else. The functions wherein rte_bitmap_free() is called do not use its return value. ``` $ git grep -Pn 'rte_bitmap_free\(' app/test/test_bitmap.c:211: rte_bitmap_free(bmp); app/test/test_bitmap.c:257: rte_bitmap_free(bmp); devtools/cocci/nullfree.cocci:19:- if (E != NULL) rte_bitmap_free(E); devtools/cocci/nullfree.cocci:20:+ rte_bitmap_free(E); drivers/common/cnxk/roc_platform.h:127:#define plt_bitmap_free rte_bitmap_free drivers/common/mlx5/mlx5_common_mr.c:497: rte_bitmap_free(mr->ms_bmp); drivers/crypto/ionic/ionic_crypto_main.c:817: rte_bitmap_free(dev->sess_bm); drivers/net/bonding/rte_eth_bond_pmd.c:2246: rte_bitmap_free(internals->vlan_filter_bmp); drivers/net/cxgbe/cxgbe_main.c:468: rte_bitmap_free(t->ftid_bmap); drivers/net/mlx4/mlx4_mr.c:474: rte_bitmap_free(mr->ms_bmp); drivers/net/netvsc/hn_rxtx.c:186: rte_bitmap_free(hv->chim_bmap); drivers/net/sfc/sfc_sw_stats.c:818: rte_bitmap_free(sa->sw_stats.queues_bitmap); lib/eal/include/rte_bitmap.h:291:rte_bitmap_free(struct rte_bitmap *bmp) ``` The clearing of these Coverity warnings have been discussed more than once this year, the question of its existence has also been asked. Subsequent commits will remove rte_bitmap_free where it was used. Coverity issue: 357712, 357737 Link: https://lore.kernel.org/all/6A08397F-8D6E-4631-B63E-4CAE319F1463@amd.com/T/#m35464e4e6dccfa904ab7e5f0a0b246e63e0ed74e Link: https://inbox.dpdk.org/dev/20241213085928.0f2f2de1@hermes.local/ Signed-off-by: Ariel Otilibili --- Cc: stable@dpdk.org Cc: Stephen Hemminger stephen@networkplumber.org Cc: Andrew Boyer --- devtools/cocci/nullfree.cocci | 3 --- lib/eal/include/rte_bitmap.h | 19 ------------------- 2 files changed, 22 deletions(-) diff --git a/devtools/cocci/nullfree.cocci b/devtools/cocci/nullfree.cocci index c0526a2a3f..8f0c4a4144 100644 --- a/devtools/cocci/nullfree.cocci +++ b/devtools/cocci/nullfree.cocci @@ -16,9 +16,6 @@ expression 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); | diff --git a/lib/eal/include/rte_bitmap.h b/lib/eal/include/rte_bitmap.h index abb102f1d3..63d54f5761 100644 --- a/lib/eal/include/rte_bitmap.h +++ b/lib/eal/include/rte_bitmap.h @@ -279,25 +279,6 @@ rte_bitmap_init_with_all_set(uint32_t n_bits, uint8_t *mem, uint32_t mem_size) return bmp; } -/** - * Bitmap free - * - * @param bmp - * Handle to bitmap instance - * @return - * 0 upon success, error code otherwise - */ -static inline int -rte_bitmap_free(struct rte_bitmap *bmp) -{ - /* Check input arguments */ - if (bmp == NULL) { - return -1; - } - - return 0; -} - /** * Bitmap reset * -- 2.47.1