lib: document free functions
authorStephen Hemminger <stephen@networkplumber.org>
Wed, 22 Jun 2022 20:52:57 +0000 (13:52 -0700)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 24 Jun 2022 12:50:34 +0000 (14:50 +0200)
Make sure all functions which use the convention that XXX_free(NULL)
is a nop are all documented.

The wording is chosen to match the documentation of free(3).
"If ptr is NULL, no operation is performed."

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
[David: squashed with other series updates, unified wording]

21 files changed:
lib/acl/rte_acl.h
lib/bitratestats/rte_bitrate.h
lib/compressdev/rte_comp.h
lib/cryptodev/rte_crypto.h
lib/eal/include/rte_interrupts.h
lib/efd/rte_efd.h
lib/eventdev/rte_event_ring.h
lib/fib/rte_fib.h
lib/fib/rte_fib6.h
lib/lpm/rte_lpm.h
lib/lpm/rte_lpm6.h
lib/member/rte_member.h
lib/pipeline/rte_port_in_action.h
lib/pipeline/rte_swx_ctl.h
lib/pipeline/rte_swx_pipeline.h
lib/reorder/rte_reorder.h
lib/rib/rte_rib.h
lib/rib/rte_rib6.h
lib/sched/rte_sched.h
lib/stack/rte_stack.h
lib/telemetry/rte_telemetry.h

index f7f5f08..ca75a6f 100644 (file)
@@ -165,6 +165,7 @@ rte_acl_find_existing(const char *name);
  *
  * @param ctx
  *   ACL context to free
+ *   If ctx is NULL, no operation is performed.
  */
 void
 rte_acl_free(struct rte_acl_ctx *ctx);
index e494389..979a712 100644 (file)
@@ -32,6 +32,7 @@ struct rte_stats_bitrates *rte_stats_bitrate_create(void);
  *
  * @param bitrate_data
  *   Pointer allocated by rte_stats_bitrate_create()
+ *   If bitrate_data is NULL, no operation is performed.
  */
 void rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data);
 
index cdb55e5..99a4871 100644 (file)
@@ -469,7 +469,8 @@ rte_comp_op_bulk_alloc(struct rte_mempool *mempool,
  * be returned to the mempool.
  *
  * @param op
- *   Compress operation
+ *   Compress operation pointer allocated from rte_comp_op_alloc()
+ *   If op is NULL, no operation is performed.
  */
 __rte_experimental
 void
index aeb3bf6..6dfca2c 100644 (file)
@@ -347,7 +347,9 @@ __rte_crypto_op_get_priv_data(struct rte_crypto_op *op, uint32_t size)
  * If operation has been allocate from a rte_mempool, then the operation will
  * be returned to the mempool.
  *
- * @param      op      symmetric crypto operation
+ * @param op
+ *   Pointer to symmetric crypto operation allocated with rte_crypto_op_alloc()
+ *   If op is NULL, no operation is performed.
  */
 static inline void
 rte_crypto_op_free(struct rte_crypto_op *op)
index 68ad19c..9d1d53f 100644 (file)
@@ -242,7 +242,8 @@ rte_intr_instance_alloc(uint32_t flags);
  * Free the memory allocated for interrupt handle resources.
  *
  * @param intr_handle
- *  Interrupt handle address.
+ *  Interrupt handle allocated with rte_intr_instance_alloc().
+ *  If intr_handle is NULL, no operation is performed.
  *
  */
 __rte_experimental
index d3d7bef..89cb4a2 100644 (file)
@@ -145,7 +145,8 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
  * Releases the resources from an EFD table
  *
  * @param table
- *   Table to free
+ *   Pointer to table allocated with rte_efd_create().
+ *   If table is NULL, no operation is performed.
  */
 void
 rte_efd_free(struct rte_efd_table *table);
index 0101cc0..7efa644 100644 (file)
@@ -234,7 +234,8 @@ rte_event_ring_lookup(const char *name);
  * De-allocate all memory used by the ring.
  *
  * @param r
- *   Ring to free
+ *   Pointer to ring to created with rte_event_ring_create().
+ *   If r is NULL, no operation is performed.
  */
 void
 rte_event_ring_free(struct rte_event_ring *r);
index 90f28b7..baa2060 100644 (file)
@@ -122,7 +122,8 @@ rte_fib_find_existing(const char *name);
  * Free an FIB object.
  *
  * @param fib
- *   FIB object handle
+ *   FIB object handle created by rte_fib_create().
+ *   If fib is NULL, no operation is performed.
  * @return
  *   None
  */
index 62a425d..6fc915b 100644 (file)
@@ -113,7 +113,8 @@ rte_fib6_find_existing(const char *name);
  * Free an FIB object.
  *
  * @param fib
- *   FIB object handle
+ *   FIB object handle created by rte_fib6_create().
+ *   If fib is NULL, no operation is performed.
  * @return
  *   None
  */
index 4f38864..c829590 100644 (file)
@@ -179,6 +179,7 @@ rte_lpm_find_existing(const char *name);
  *
  * @param lpm
  *   LPM object handle
+ *   If lpm is NULL, no operation is performed.
  * @return
  *   None
  */
index 9b07260..cd9ce17 100644 (file)
@@ -72,6 +72,7 @@ rte_lpm6_find_existing(const char *name);
  *
  * @param lpm
  *   LPM object handle
+ *   If lpm is NULL, no operation is performed.
  * @return
  *   None
  */
index 567ee0c..2611015 100644 (file)
@@ -443,6 +443,7 @@ rte_member_add(const struct rte_member_setsum *setsum, const void *key,
  *
  * @param setsum
  *   Pointer to the set summary.
+ *   If setsum is NULL, no operation is performed.
  */
 void
 rte_member_free(struct rte_member_setsum *setsum);
index d6b063c..ec29945 100644 (file)
@@ -181,8 +181,9 @@ rte_port_in_action_profile_create(uint32_t socket_id);
  *
  * @param[in] profile
  *   Input port action profile handle (needs to be valid).
+ *   If profile is NULL, no operation is performed.
  * @return
- *   Zero on success, non-zero error code otherwise.
+ *   Always zero.
  */
 __rte_experimental
 int
@@ -259,8 +260,9 @@ rte_port_in_action_create(struct rte_port_in_action_profile *profile,
  *
  * @param[in] action
  *   Handle to input port action object (needs to be valid).
+ *   If action is NULL, no operation is performed.
  * @return
- *   Zero on success, non-zero error code otherwise.
+ *   Always zero.
  */
 __rte_experimental
 int
index 689f45e..d771389 100644 (file)
@@ -1375,6 +1375,7 @@ rte_swx_ctl_meter_stats_read(struct rte_swx_pipeline *p,
  *
  * @param[in] ctl
  *   Pipeline control handle.
+ *   If ctl is NULL, no operation is performed.
  */
 __rte_experimental
 void
index 9299f27..c41ca5c 100644 (file)
@@ -987,6 +987,7 @@ rte_swx_pipeline_run(struct rte_swx_pipeline *p,
  *
  * @param[in] p
  *   Pipeline handle.
+ *   If p is NULL, no operation is performed.
  */
 __rte_experimental
 void
index 9de0240..f72f07e 100644 (file)
@@ -114,7 +114,8 @@ rte_reorder_reset(struct rte_reorder_buffer *b);
  * Free reorder buffer instance.
  *
  * @param b
- *   reorder buffer instance
+ *   Pointer to reorder buffer instance.
+ *   If b is NULL, no operation is performed.
  * @return
  *   None
  */
index c18c4ca..f41774a 100644 (file)
@@ -263,7 +263,8 @@ rte_rib_find_existing(const char *name);
  * Free an RIB object.
  *
  * @param rib
- *   RIB object handle
+ *   RIB object handle created with rte_rib_create().
+ *   If rib is NULL, no operation is performed.
  * @return
  *   None
  */
index fa8e9bf..8bd99c4 100644 (file)
@@ -318,7 +318,8 @@ rte_rib6_find_existing(const char *name);
  * Free an RIB object.
  *
  * @param rib
- *   RIB object handle
+ *   RIB object handle created with rte_rib6_create().
+ *   If rib is NULL, no operation is performed.
  * @return
  *   None
  */
index 0bd5b72..a33292b 100644 (file)
@@ -328,7 +328,8 @@ rte_sched_port_config(struct rte_sched_port_params *params);
  * Hierarchical scheduler port free
  *
  * @param port
- *   Handle to port scheduler instance
+ *   Handle to port scheduler instance.
+ *   If port is NULL, no operation is performed.
  */
 void
 rte_sched_port_free(struct rte_sched_port *port);
index 91fc570..278a5bd 100644 (file)
@@ -213,7 +213,8 @@ rte_stack_create(const char *name, unsigned int count, int socket_id,
  * Free all memory used by the stack.
  *
  * @param s
- *   Stack to free
+ *   Pointer to stack created with rte_stack_create().
+ *   If s is NULL, no operation is performed.
  */
 void
 rte_stack_free(struct rte_stack *s);
index 3372b32..d586dd0 100644 (file)
@@ -293,7 +293,7 @@ rte_tel_data_alloc(void);
  *
  * @param data
  *  Pointer to container.
- *.
+ *  If data is NULL, no operation is performed.
  */
 void
 rte_tel_data_free(struct rte_tel_data *data);