patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ariel Otilibili <otilibil@eurecom.fr>
To: dev@dpdk.org
Cc: stable@dpdk.org, Ariel Otilibili <otilibil@eurecom.fr>,
	Andrew Boyer <andrew.boyer@amd.com>
Subject: [PATCH v3 01/10] devtools/cocci, lib/eal: remove unused rte_bitmap_free()
Date: Sun, 22 Dec 2024 02:19:53 +0100	[thread overview]
Message-ID: <20241222013328.1362225-2-otilibil@eurecom.fr> (raw)
In-Reply-To: <20241222013328.1362225-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.

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 <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  1:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-22  1:19 [PATCH v3 00/10] devtools, lib, test, net, common: " Ariel Otilibili
2024-12-22  1:19 ` Ariel Otilibili [this message]
2024-12-22 16:43   ` [PATCH v3 01/10] devtools/cocci, lib/eal: " Stephen Hemminger
2024-12-22  1:19 ` [PATCH v3 02/10] app/test: remove unsued rte_bitmap_free() Ariel Otilibili
2024-12-22  1:19 ` [PATCH v3 03/10] net/sfc: remove unused rte_bitmap_free() Ariel Otilibili
2024-12-22  1:19 ` [PATCH v3 04/10] crypto/ionic: " Ariel Otilibili
2024-12-22  1:19 ` [PATCH v3 05/10] net/cxgbe: " Ariel Otilibili
2024-12-22  1:19 ` [PATCH v3 06/10] net/mlx4: " Ariel Otilibili
2024-12-22  1:19 ` [PATCH v3 07/10] common/mlx5: " Ariel Otilibili
2024-12-22  1:20 ` [PATCH v3 08/10] net/bonding: " Ariel Otilibili
2024-12-22  1:20 ` [PATCH v3 09/10] net/netvsc: " Ariel Otilibili
2024-12-22  1:20 ` [PATCH v3 10/10] common/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=20241222013328.1362225-2-otilibil@eurecom.fr \
    --to=otilibil@eurecom.fr \
    --cc=andrew.boyer@amd.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /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).