[v2] bitmap: change return value of rte_bitmap_free

Message ID 20251029145055.990899-1-stephen@networkplumber.org (mailing list archive)
State Accepted
Delegated to: Thomas Monjalon
Headers
Series [v2] bitmap: change return value of rte_bitmap_free |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Functional success Functional Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-compile-amd64-testing fail Testing issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-sample-apps-testing warning Testing issues
ci/github-robot: build success github build: passed
ci/github-robot-post success github post: success
ci/iol-unit-amd64-testing success Testing PASS
ci/aws-unit-testing success Unit Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS

Commit Message

Stephen Hemminger Oct. 29, 2025, 2:50 p.m. UTC
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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 doc/guides/rel_notes/release_25_11.rst |  3 +++
 lib/eal/include/rte_bitmap.h           | 13 ++++---------
 2 files changed, 7 insertions(+), 9 deletions(-)
  

Comments

Konstantin Ananyev Oct. 30, 2025, 7:57 a.m. UTC | #1
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Wednesday, October 29, 2025 2:51 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Morten Brørup
> <mb@smartsharesystems.com>; Cristian Dumitrescu
> <cristian.dumitrescu@intel.com>; Tyler Retzlaff <roretzla@linux.microsoft.com>
> 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.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
> ---
>  doc/guides/rel_notes/release_25_11.rst |  3 +++
>  lib/eal/include/rte_bitmap.h           | 13 ++++---------
>  2 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_25_11.rst
> b/doc/guides/rel_notes/release_25_11.rst
> index c5ba335cfc..4b8e084204 100644
> --- a/doc/guides/rel_notes/release_25_11.rst
> +++ b/doc/guides/rel_notes/release_25_11.rst
> @@ -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
>  -----------
> diff --git a/lib/eal/include/rte_bitmap.h b/lib/eal/include/rte_bitmap.h
> index abb102f1d3..ebe6c44998 100644
> --- a/lib/eal/include/rte_bitmap.h
> +++ b/lib/eal/include/rte_bitmap.h
> @@ -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);
>  }
> 
>  /**
> --
Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> 2.51.0
  
Thomas Monjalon Nov. 11, 2025, 2:06 p.m. UTC | #2
> > 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.
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>

Applied, thanks.
  

Patch

diff --git a/doc/guides/rel_notes/release_25_11.rst b/doc/guides/rel_notes/release_25_11.rst
index c5ba335cfc..4b8e084204 100644
--- a/doc/guides/rel_notes/release_25_11.rst
+++ b/doc/guides/rel_notes/release_25_11.rst
@@ -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
 -----------
diff --git a/lib/eal/include/rte_bitmap.h b/lib/eal/include/rte_bitmap.h
index abb102f1d3..ebe6c44998 100644
--- a/lib/eal/include/rte_bitmap.h
+++ b/lib/eal/include/rte_bitmap.h
@@ -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);
 }
 
 /**