On Friday, December 13, 2024 17:59 CET, Stephen Hemminger <step...@networkplumber.org> wrote:
> On Fri, 13 Dec 2024 12:30:00 +0100 > Ariel Otilibili <otili...@eurecom.fr> wrote: > > > * rte_bitmap_free is only useful for its return value > > * and its return value is not used. > > > > ``` > > $ < lib/eal/include/rte_bitmap.h sed -ne '/bitmap_free/,/^}/p' > > > > rte_bitmap_free(struct rte_bitmap *bmp) > > { > > /* Check input arguments */ > > if (bmp == NULL) { > > return -1; > > } > > > > return 0; > > } > > ``` > > > > Reported-by: Coverity, IDs 357712 & 357737 > > Signed-off-by: Ariel Otilibili <otili...@eurecom.fr> > > --- > > app/test/test_bitmap.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/app/test/test_bitmap.c b/app/test/test_bitmap.c > > index bab11812c7..a21210a215 100644 > > --- a/app/test/test_bitmap.c > > +++ b/app/test/test_bitmap.c > > @@ -208,7 +208,6 @@ test_bitmap_all_clear(void) > > if (test_bitmap_scan_operations(bmp) < 0) > > return TEST_FAILED; > > > > - rte_bitmap_free(bmp); > > rte_free(mem); > > > > return TEST_SUCCESS; > > @@ -254,7 +253,6 @@ test_bitmap_all_set(void) > > return TEST_FAILED; > > } > > > > - rte_bitmap_free(bmp); > > rte_free(mem); > > > > return TEST_SUCCESS; > > I would rather that, rte_bitmap_free() be made a real function > which would shutup Coverity. > > And rte_bitmap_free() should just be a void function, like all the > other XXX_free() variants in DPDK. I will work on a Version 3 of this series, Stephen; your feedback landed into Version 1. For my understanding, on which of the XXX_free should I model a rte_bitmap_free returning void? Here are the occurrences of rte_bitmap_free() ``` $ 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/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) ```