DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Fan Zhang <roy.fan.zhang@intel.com>,
	Ashish Gupta <ashish.gupta@marvell.com>,
	Akhil Goyal <gakhil@marvell.com>,
	Harman Kalra <hkalra@marvell.com>,
	Byron Marohn <byron.marohn@intel.com>,
	Yipeng Wang <yipeng1.wang@intel.com>,
	Jerin Jacob <jerinj@marvell.com>,
	Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
	Sameh Gobriel <sameh.gobriel@intel.com>,
	Reshma Pattan <reshma.pattan@intel.com>,
	Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
	Jasvinder Singh <jasvinder.singh@intel.com>,
	Olivier Matz <olivier.matz@6wind.com>,
	Ciara Power <ciara.power@intel.com>
Subject: [PATCH v4] lib: document existing free functions
Date: Wed, 22 Jun 2022 13:52:57 -0700	[thread overview]
Message-ID: <20220622205257.404945-1-stephen@networkplumber.org> (raw)
In-Reply-To: <20220220182147.9750-1-stephen@networkplumber.org>

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>
---
 lib/bitratestats/rte_bitrate.h   | 1 +
 lib/compressdev/rte_comp.h       | 3 ++-
 lib/cryptodev/rte_crypto.h       | 4 +++-
 lib/eal/include/rte_interrupts.h | 3 ++-
 lib/efd/rte_efd.h                | 3 ++-
 lib/eventdev/rte_event_ring.h    | 3 ++-
 lib/fib/rte_fib.h                | 3 ++-
 lib/fib/rte_fib6.h               | 3 ++-
 lib/member/rte_member.h          | 1 +
 lib/reorder/rte_reorder.h        | 3 ++-
 lib/rib/rte_rib.h                | 3 ++-
 lib/rib/rte_rib6.h               | 3 ++-
 lib/sched/rte_sched.h            | 3 ++-
 lib/stack/rte_stack.h            | 3 ++-
 lib/telemetry/rte_telemetry.h    | 2 +-
 15 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/lib/bitratestats/rte_bitrate.h b/lib/bitratestats/rte_bitrate.h
index e494389b95a0..35cb44be1b7d 100644
--- a/lib/bitratestats/rte_bitrate.h
+++ b/lib/bitratestats/rte_bitrate.h
@@ -32,6 +32,7 @@ struct rte_stats_bitrates *rte_stats_bitrate_create(void);
  *
  * @param bitrate_data
  *   Pointer allocated by rte_stats_bitrate_create()
+ *   If pointer is NULL, no operation is performed.
  */
 void rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data);
 
diff --git a/lib/compressdev/rte_comp.h b/lib/compressdev/rte_comp.h
index cdb55e5887d3..8cc60bf9e898 100644
--- a/lib/compressdev/rte_comp.h
+++ b/lib/compressdev/rte_comp.h
@@ -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 pointer is NULL, no operation is performed.
  */
 __rte_experimental
 void
diff --git a/lib/cryptodev/rte_crypto.h b/lib/cryptodev/rte_crypto.h
index aeb3bf6e383a..e03bbeceddef 100644
--- a/lib/cryptodev/rte_crypto.h
+++ b/lib/cryptodev/rte_crypto.h
@@ -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 pointer is NULL, no operation is performed.
  */
 static inline void
 rte_crypto_op_free(struct rte_crypto_op *op)
diff --git a/lib/eal/include/rte_interrupts.h b/lib/eal/include/rte_interrupts.h
index 68ad19c3e742..4361ecc565d3 100644
--- a/lib/eal/include/rte_interrupts.h
+++ b/lib/eal/include/rte_interrupts.h
@@ -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 handle is NULL, no operation is performed.
  *
  */
 __rte_experimental
diff --git a/lib/efd/rte_efd.h b/lib/efd/rte_efd.h
index d3d7befd0c90..b4ef783b8783 100644
--- a/lib/efd/rte_efd.h
+++ b/lib/efd/rte_efd.h
@@ -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 pointer is NULL, no operation is performed.
  */
 void
 rte_efd_free(struct rte_efd_table *table);
diff --git a/lib/eventdev/rte_event_ring.h b/lib/eventdev/rte_event_ring.h
index 0101cc0aa232..34abe8d51831 100644
--- a/lib/eventdev/rte_event_ring.h
+++ b/lib/eventdev/rte_event_ring.h
@@ -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 pointer is NULL, no operation is performed.
  */
 void
 rte_event_ring_free(struct rte_event_ring *r);
diff --git a/lib/fib/rte_fib.h b/lib/fib/rte_fib.h
index 90f28b7e11ad..29d99105dcc5 100644
--- a/lib/fib/rte_fib.h
+++ b/lib/fib/rte_fib.h
@@ -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 handle is NULL, no operation is performed.
  * @return
  *   None
  */
diff --git a/lib/fib/rte_fib6.h b/lib/fib/rte_fib6.h
index 62a425d9afe2..a9a02257ee5c 100644
--- a/lib/fib/rte_fib6.h
+++ b/lib/fib/rte_fib6.h
@@ -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 handle is NULL, no operation is performed.
  * @return
  *   None
  */
diff --git a/lib/member/rte_member.h b/lib/member/rte_member.h
index 567ee0c84bd9..41c730ba76a3 100644
--- a/lib/member/rte_member.h
+++ b/lib/member/rte_member.h
@@ -443,6 +443,7 @@ rte_member_add(const struct rte_member_setsum *setsum, const void *key,
  *
  * @param setsum
  *   Pointer to the set summary.
+ *   If pointer is NULL, no operation is performed.
  */
 void
 rte_member_free(struct rte_member_setsum *setsum);
diff --git a/lib/reorder/rte_reorder.h b/lib/reorder/rte_reorder.h
index 9de02403746b..4dedc36b8a80 100644
--- a/lib/reorder/rte_reorder.h
+++ b/lib/reorder/rte_reorder.h
@@ -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 pointer is NULL, no operation is performed.
  * @return
  *   None
  */
diff --git a/lib/rib/rte_rib.h b/lib/rib/rte_rib.h
index c18c4ca594c1..7c3d0997244f 100644
--- a/lib/rib/rte_rib.h
+++ b/lib/rib/rte_rib.h
@@ -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 handle is NULL, no operation is performed.
  * @return
  *   None
  */
diff --git a/lib/rib/rte_rib6.h b/lib/rib/rte_rib6.h
index fa8e9bf7327b..64301776b51f 100644
--- a/lib/rib/rte_rib6.h
+++ b/lib/rib/rte_rib6.h
@@ -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 handle is NULL, no operation is performed.
  * @return
  *   None
  */
diff --git a/lib/sched/rte_sched.h b/lib/sched/rte_sched.h
index 0bd5b72a4a7a..0ba4ef6dec01 100644
--- a/lib/sched/rte_sched.h
+++ b/lib/sched/rte_sched.h
@@ -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 handle is NULL, no operation is performed.
  */
 void
 rte_sched_port_free(struct rte_sched_port *port);
diff --git a/lib/stack/rte_stack.h b/lib/stack/rte_stack.h
index 91fc5707670f..33ea451223e5 100644
--- a/lib/stack/rte_stack.h
+++ b/lib/stack/rte_stack.h
@@ -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 pointer is NULL, no operation is performed.
  */
 void
 rte_stack_free(struct rte_stack *s);
diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h
index 3372b32f38b5..a49a6d1e571b 100644
--- a/lib/telemetry/rte_telemetry.h
+++ b/lib/telemetry/rte_telemetry.h
@@ -293,7 +293,7 @@ rte_tel_data_alloc(void);
  *
  * @param data
  *  Pointer to container.
- *.
+ *  If pointer is NULL, no operation is performed.
  */
 void
 rte_tel_data_free(struct rte_tel_data *data);
-- 
2.35.1


  parent reply	other threads:[~2022-06-22 20:53 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-19 23:43 [PATCH 0/3] more unnecessary null checks Stephen Hemminger
2022-02-19 23:43 ` [PATCH 1/3] cocci/nullfree: add more functions Stephen Hemminger
2022-02-19 23:43 ` [PATCH 2/3] acl: remove unncessary null checks in calls to rte_acl_free() Stephen Hemminger
2022-02-19 23:43 ` [PATCH 3/3] lpm: remove unnecessary NULL checks Stephen Hemminger
2022-02-20  0:51 ` [PATCH v2 0/7] fix more unnecessary null checks Stephen Hemminger
2022-02-20  0:51   ` [PATCH v2 1/7] cocci/nullfree: add more functions Stephen Hemminger
2022-02-20  0:51   ` [PATCH v2 2/7] acl: remove unnecessary null checks Stephen Hemminger
2022-02-20  0:51   ` [PATCH v2 3/7] lpm: remove unnecessary NULL checks Stephen Hemminger
2022-02-20  0:51   ` [PATCH v2 4/7] lib: document existing free functions Stephen Hemminger
2022-02-20  0:51   ` [PATCH v2 5/7] test: remove unecessary NULL checks before free Stephen Hemminger
2022-02-20  0:51   ` [PATCH v2 6/7] fips_validation: remove unnecessary NULL check Stephen Hemminger
2022-02-20  0:51   ` [PATCH v2 7/7] event/sw: " Stephen Hemminger
2022-02-20  5:18 ` [PATCH 0/3] more unnecessary null checks Jerin Jacob
2022-02-20 18:21 ` [PATCH v3 0/8] yet more unnecessary NULL checks Stephen Hemminger
2022-02-20 18:21   ` [PATCH v3 1/8] cocci/nullfree: add more functions Stephen Hemminger
2022-02-20 18:21   ` [PATCH v3 2/8] acl: remove unnecessary null checks Stephen Hemminger
2022-02-20 18:21   ` [PATCH v3 3/8] lpm: remove unnecessary NULL checks Stephen Hemminger
2022-02-21  2:47     ` Ruifeng Wang
2022-02-21 15:51     ` Medvedkin, Vladimir
2022-02-20 18:21   ` [PATCH v3 4/8] lib: document existing free functions Stephen Hemminger
2022-02-27 20:48     ` Thomas Monjalon
2022-02-28  9:42       ` Bruce Richardson
2022-02-28 17:08         ` Stephen Hemminger
2022-06-22  9:23           ` Thomas Monjalon
2022-06-22 14:55             ` Stephen Hemminger
2022-02-20 18:21   ` [PATCH v3 5/8] test: remove unnecessary NULL checks before free Stephen Hemminger
2022-02-20 18:21   ` [PATCH v3 6/8] fips_validation: remove unnecessary NULL check Stephen Hemminger
2022-02-20 18:21   ` [PATCH v3 7/8] event/sw: " Stephen Hemminger
2022-02-20 18:21   ` [PATCH v3 8/8] pipeline: remove unnecessary checks for NULL pointer before free Stephen Hemminger
2022-06-22 20:52   ` Stephen Hemminger [this message]
2022-06-23  0:37     ` [PATCH v4] lib: document existing free functions fengchengwen
2022-06-24 12:35     ` David Marchand
2022-06-24 12:41   ` [PATCH v3 0/8] yet more unnecessary NULL checks David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220622205257.404945-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=ashish.gupta@marvell.com \
    --cc=byron.marohn@intel.com \
    --cc=ciara.power@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=hkalra@marvell.com \
    --cc=jasvinder.singh@intel.com \
    --cc=jerinj@marvell.com \
    --cc=olivier.matz@6wind.com \
    --cc=reshma.pattan@intel.com \
    --cc=roy.fan.zhang@intel.com \
    --cc=sameh.gobriel@intel.com \
    --cc=vladimir.medvedkin@intel.com \
    --cc=yipeng1.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).