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/[email protected]/T/#m35464e4e6dccfa904ab7e5f0a0b246e63e0ed74e
Link: https://inbox.dpdk.org/dev/[email protected]/
Signed-off-by: Ariel Otilibili <[email protected]>
---
Cc: [email protected]
Cc: Stephen Hemminger <[email protected]>
Cc: Andrew Boyer <[email protected]>
---
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