patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ariel Otilibili <otilibil@eurecom.fr>
To: dev@dpdk.org
Cc: stable@dpdk.org, Thomas Monjalon <thomas@monjalon.net>,
	David Marchand <david.marchand@redhat.com>,
	Ariel Otilibili <otilibil@eurecom.fr>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Andrew Boyer <andrew.boyer@amd.com>
Subject: [PATCH v4 01/11] devtools/cocci, lib/eal: remove unused rte_bitmap_free()
Date: Sun, 22 Dec 2024 13:49:21 +0100	[thread overview]
Message-ID: <20241222125725.1532157-2-otilibil@eurecom.fr> (raw)
In-Reply-To: <20241222125725.1532157-1-otilibil@eurecom.fr>

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.

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 <otilibil@eurecom.fr>
---
Cc: stable@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: Andrew Boyer <andrew.boyer@amd.com>
---
 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


  reply	other threads:[~2024-12-22 12:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-22 12:49 [PATCH v4 00/11] devtools, lib, test, net, common: remove unused rte_bitmap_free() and plt_bitmap_free() Ariel Otilibili
2024-12-22 12:49 ` Ariel Otilibili [this message]
2024-12-22 12:49 ` [PATCH v4 02/11] app/test: remove unused rte_bitmap_free() Ariel Otilibili
2024-12-22 12:49 ` [PATCH v4 03/11] net/sfc: " Ariel Otilibili
2024-12-22 12:49 ` [PATCH v4 04/11] crypto/ionic: " Ariel Otilibili
2024-12-22 12:49 ` [PATCH v4 05/11] net/cxgbe: " Ariel Otilibili
2024-12-22 12:49 ` [PATCH v4 06/11] net/mlx4: " Ariel Otilibili
2024-12-22 12:49 ` [PATCH v4 07/11] common/mlx5: " Ariel Otilibili
2024-12-22 12:49 ` [PATCH v4 08/11] net/bonding: " Ariel Otilibili
2024-12-22 12:49 ` [PATCH v4 09/11] net/netvsc: " Ariel Otilibili
2024-12-22 12:49 ` [PATCH v4 10/11] common/cnxk: remove unused plt_bitmap_free() Ariel Otilibili
2024-12-22 12:49 ` [PATCH v4 11/11] {common,net}/cnxk: " Ariel Otilibili

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241222125725.1532157-2-otilibil@eurecom.fr \
    --to=otilibil@eurecom.fr \
    --cc=andrew.boyer@amd.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).