Skip to contentSkip to conversation

bitmap: change return value of rte_bitmap_free

PATCH Superseded Stephen Hemminger 4 participants 5 messages Oct 28, 2025 – Nov 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitmap: change return value of rte_bitmap_free

No existing code is checking the return value of rte_bitmap_free and other functions like rte_free do not return an int. Change it to just a stub void function.

This was motivated by Coverity warnings about unchecked return value.

---
 doc/guides/rel_notes/release_25_11.rst |  3 +++
 lib/eal/include/rte_bitmap.h           | 14 +++-----------
 2 files changed, 6 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_25_11.rst +3 -0
index c5ba335cfc..4b8e084204 100644
@@ -220,6 +220,9 @@ API Changes
   The link type was previously hardcoded to the Ethernet link type in the API.
   This argument is added to ``rte_pcapng_add_interface``.
 
+* bitmap: Changed the return type of ``rte_bitmap_free()`` to void
+  for consistency with other free functions.
+
 
 ABI Changes
 -----------
lib/eal/include/rte_bitmap.h +3 -11
index abb102f1d3..5a4a68cc2d 100644
@@ -280,22 +280,14 @@ rte_bitmap_init_with_all_set(uint32_t n_bits, uint8_t *mem, uint32_t mem_size)
 }
 
 /**
- * Bitmap free
+ * Bitmap free does nothing in current version.
  *
  * @param bmp
  *   Handle to bitmap instance
- * @return
- *   0 upon success, error code otherwise
  */
-static inline int
-rte_bitmap_free(struct rte_bitmap *bmp)
+static inline void
+rte_bitmap_free(struct rte_bitmap *bmp __rte_unused)
 {
-	/* Check input arguments */
-	if (bmp == NULL) {
-		return -1;
-	}
-
-	return 0;
 }
 
 /**
Signature · 1 line
2.51.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines

From: Stephen Hemminger [mailto:[email protected]]
Sent: Tuesday, 28 October 2025 21.45

No existing code is checking the return value of rte_bitmap_free and other functions like rte_free do not return an int. Change it to just a stub void function.

This was motivated by Coverity warnings about unchecked return value.

Thank you for cleaning up this.

With or without suggestion inline below,

Quoted 3 lines

/**
- * Bitmap free
+ * Bitmap free does nothing in current version.

Consider keeping the original headline and adding a note that it does nothing in current version instead.

Quoted 18 lines

*
* @param bmp
* Handle to bitmap instance
- * @return
- * 0 upon success, error code otherwise
*/

lib/eal/include/rte_bitmap.h +2 -8
-static inline int
-rte_bitmap_free(struct rte_bitmap *bmp)
+static inline void
+rte_bitmap_free(struct rte_bitmap *bmp __rte_unused)
 {
-	/* Check input arguments */
-	if (bmp == NULL) {
-		return -1;
-	}
-
-	return 0;
 }
#2 lore raw

PATCH v2 1/1 bitmap: change return value of rte_bitmap_free

In reply to Stephen Hemminger

No existing code is checking the return value of rte_bitmap_free and other functions like rte_free do not return an int. Change it to just a stub void function.

This was motivated by Coverity warnings about unchecked return value.

---
 doc/guides/rel_notes/release_25_11.rst |  3 +++
 lib/eal/include/rte_bitmap.h           | 13 ++++---------
 2 files changed, 7 insertions(+), 9 deletions(-)
doc/guides/rel_notes/release_25_11.rst +3 -0
index c5ba335cfc..4b8e084204 100644
@@ -220,6 +220,9 @@ API Changes
   The link type was previously hardcoded to the Ethernet link type in the API.
   This argument is added to ``rte_pcapng_add_interface``.
 
+* bitmap: Changed the return type of ``rte_bitmap_free()`` to void
+  for consistency with other free functions.
+
 
 ABI Changes
 -----------
lib/eal/include/rte_bitmap.h +4 -9
index abb102f1d3..ebe6c44998 100644
@@ -282,20 +282,15 @@ rte_bitmap_init_with_all_set(uint32_t n_bits, uint8_t *mem, uint32_t mem_size)
 /**
  * Bitmap free
  *
+ * This function does nothing in current implementation.
+ *
  * @param bmp
  *   Handle to bitmap instance
- * @return
- *   0 upon success, error code otherwise
  */
-static inline int
+static inline void
 rte_bitmap_free(struct rte_bitmap *bmp)
 {
-	/* Check input arguments */
-	if (bmp == NULL) {
-		return -1;
-	}
-
-	return 0;
+	RTE_SET_USED(bmp);
 }
 
 /**
Signature · 1 line
2.51.0
Acked-by on v2 1/1
#3 lore raw
Quoted 69 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Wednesday, October 29, 2025 2:51 PM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Morten Brørup <[email protected]>; Cristian Dumitrescu <[email protected]>; Tyler Retzlaff <[email protected]>
Subject: [PATCH v2] bitmap: change return value of rte_bitmap_free

No existing code is checking the return value of rte_bitmap_free and other functions like rte_free do not return an int. Change it to just a stub void function.

This was motivated by Coverity warnings about unchecked return value.

---
 doc/guides/rel_notes/release_25_11.rst |  3 +++
 lib/eal/include/rte_bitmap.h           | 13 ++++---------
 2 files changed, 7 insertions(+), 9 deletions(-)
doc/guides/rel_notes/release_25_11.rst +3 -0
index c5ba335cfc..4b8e084204 100644
@@ -220,6 +220,9 @@ API Changes
   The link type was previously hardcoded to the Ethernet link type in the API.
   This argument is added to ``rte_pcapng_add_interface``.
 
+* bitmap: Changed the return type of ``rte_bitmap_free()`` to void
+  for consistency with other free functions.
+
 
 ABI Changes
 -----------
lib/eal/include/rte_bitmap.h +4 -9
index abb102f1d3..ebe6c44998 100644
@@ -282,20 +282,15 @@ rte_bitmap_init_with_all_set(uint32_t n_bits, uint8_t
 *mem, uint32_t mem_size)
 /**
  * Bitmap free
  *
+ * This function does nothing in current implementation.
+ *
  * @param bmp
  *   Handle to bitmap instance
- * @return
- *   0 upon success, error code otherwise
  */
-static inline int
+static inline void
 rte_bitmap_free(struct rte_bitmap *bmp)
 {
-	/* Check input arguments */
-	if (bmp == NULL) {
-		return -1;
-	}
-
-	return 0;
+	RTE_SET_USED(bmp);
 }
 
Quoted 2 lines

/**
--

Quoted 1 line

2.51.0