DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: David Marchand <david.marchand@redhat.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>,
	Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH v4 8/9] net/ice/base: reduce warnings for unused variables
Date: Fri, 28 Mar 2025 11:16:20 +0000	[thread overview]
Message-ID: <20250328111621.2665257-9-bruce.richardson@intel.com> (raw)
In-Reply-To: <20250328111621.2665257-1-bruce.richardson@intel.com>

Improve base code macros to reduce the number of issues with unused
variables in the code. Issues still remain with unused-but-set
variables, but completely unused variable warnings are eliminated.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ice/base/ice_osdep.h  | 6 +++---
 drivers/net/intel/ice/base/ice_switch.c | 2 --
 drivers/net/intel/ice/base/ice_type.h   | 2 +-
 drivers/net/intel/ice/base/meson.build  | 1 -
 drivers/net/intel/ice/ice_fdir_filter.c | 2 +-
 5 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/net/intel/ice/base/ice_osdep.h b/drivers/net/intel/ice/base/ice_osdep.h
index 7b96fcde03..ad6cde9896 100644
--- a/drivers/net/intel/ice/base/ice_osdep.h
+++ b/drivers/net/intel/ice/base/ice_osdep.h
@@ -196,9 +196,9 @@ struct __rte_packed_begin ice_virt_mem {
 	u32 size;
 } __rte_packed_end;
 
-#define ice_malloc(h, s)    rte_zmalloc(NULL, s, 0)
-#define ice_calloc(h, c, s) rte_calloc(NULL, c, s, 0)
-#define ice_free(h, m)         rte_free(m)
+#define ice_malloc(h, s)    ((void)h, rte_zmalloc(NULL, s, 0))
+#define ice_calloc(h, c, s) ((void)h, rte_calloc(NULL, c, s, 0))
+#define ice_free(h, m)      ((void)h, rte_free(m))
 
 #define ice_memset(a, b, c, d) memset((a), (b), (c))
 #define ice_memcpy(a, b, c, d) rte_memcpy((a), (b), (c))
diff --git a/drivers/net/intel/ice/base/ice_switch.c b/drivers/net/intel/ice/base/ice_switch.c
index a3786961e6..468a9f055d 100644
--- a/drivers/net/intel/ice/base/ice_switch.c
+++ b/drivers/net/intel/ice/base/ice_switch.c
@@ -8190,7 +8190,6 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	struct ice_sw_recipe *rm;
 	u8 i;
 	int status = ICE_SUCCESS;
-	u16 cnt;
 
 	if (!ice_is_prof_rule(rinfo->tun_type) && !lkups_cnt)
 		return ICE_ERR_PARAM;
@@ -9795,7 +9794,6 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	bool remove_rule = false;
 	struct ice_lock *rule_lock; /* Lock to protect filter rule list */
 	u16 i, rid, vsi_handle;
-	bool is_add = false;
 	int status = ICE_SUCCESS;
 
 	ice_memset(&lkup_exts, 0, sizeof(lkup_exts), ICE_NONDMA_MEM);
diff --git a/drivers/net/intel/ice/base/ice_type.h b/drivers/net/intel/ice/base/ice_type.h
index 35f832eb9f..297a5ea890 100644
--- a/drivers/net/intel/ice/base/ice_type.h
+++ b/drivers/net/intel/ice/base/ice_type.h
@@ -153,7 +153,7 @@ static inline u32 ice_round_to_num(u32 N, u32 R)
 #define ICE_DBG_USER		BIT_ULL(31)
 #define ICE_DBG_ALL		0xFFFFFFFFFFFFFFFFULL
 
-#define __ALWAYS_UNUSED
+#define __ALWAYS_UNUSED __rte_unused
 
 #define IS_ETHER_ADDR_EQUAL(addr1, addr2) \
 	(((bool)((((u16 *)(addr1))[0] == ((u16 *)(addr2))[0]))) && \
diff --git a/drivers/net/intel/ice/base/meson.build b/drivers/net/intel/ice/base/meson.build
index 38d092c370..e7ba9c34bc 100644
--- a/drivers/net/intel/ice/base/meson.build
+++ b/drivers/net/intel/ice/base/meson.build
@@ -39,7 +39,6 @@ if is_ms_compiler
 else
     error_cflags = [
             '-Wno-unused-but-set-variable',
-            '-Wno-unused-variable',
             '-Wno-unused-parameter',
     ]
 endif
diff --git a/drivers/net/intel/ice/ice_fdir_filter.c b/drivers/net/intel/ice/ice_fdir_filter.c
index 940fe171b6..2ff0090aca 100644
--- a/drivers/net/intel/ice/ice_fdir_filter.c
+++ b/drivers/net/intel/ice/ice_fdir_filter.c
@@ -1090,7 +1090,7 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
 		return -EINVAL;
 
 	seg_tun = (struct ice_flow_seg_info *)
-		ice_malloc(hw, sizeof(*seg_tun) * ICE_FD_HW_SEG_MAX);
+		ice_malloc(pf->adapter->hw, sizeof(*seg_tun) * ICE_FD_HW_SEG_MAX);
 	if (!seg_tun) {
 		PMD_DRV_LOG(ERR, "No memory can be allocated");
 		return -ENOMEM;
-- 
2.45.2


  parent reply	other threads:[~2025-03-28 11:17 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-26 15:52 [PATCH 0/7] net/intel: clean up base code build Bruce Richardson
2025-03-26 15:52 ` [PATCH 1/7] net/iavf/base: remove unused meson.build file Bruce Richardson
2025-03-26 15:52 ` [PATCH 2/7] net/ixgbe/base: correct definition of macro Bruce Richardson
2025-03-26 15:52 ` [PATCH 3/7] net/ixgbe/base: fix compilation warnings Bruce Richardson
2025-03-26 15:52 ` [PATCH 4/7] net/i40e/base: fix unused value warnings Bruce Richardson
2025-03-26 15:52 ` [PATCH 5/7] net/i40e/base: fix compiler warnings Bruce Richardson
2025-03-26 15:52 ` [PATCH 6/7] net/ice/base: reduce warnings for unused variables Bruce Richardson
2025-03-26 15:52 ` [PATCH 7/7] net/intel: simplify base code builds Bruce Richardson
2025-03-26 16:05 ` [PATCH v2 0/8] net/intel: clean up base code build Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 1/8] net/fm10k/base: fix compilation warnings Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 2/8] net/iavf/base: remove unused meson.build file Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 3/8] net/ixgbe/base: correct definition of macro Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 4/8] net/ixgbe/base: fix compilation warnings Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 5/8] net/i40e/base: fix unused value warnings Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 6/8] net/i40e/base: fix compiler warnings Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 7/8] net/ice/base: reduce warnings for unused variables Bruce Richardson
2025-03-26 16:05   ` [PATCH v2 8/8] net/intel: simplify base code builds Bruce Richardson
2025-03-27 14:51 ` [PATCH v3 0/9] net/intel: clean up base code build Bruce Richardson
2025-03-27 14:51   ` [PATCH v3 1/9] net/fm10k/base: fix compilation warnings Bruce Richardson
2025-03-27 14:51   ` [PATCH v3 2/9] net/iavf/base: remove unused meson.build file Bruce Richardson
2025-03-27 14:51   ` [PATCH v3 3/9] net/ixgbe/base: correct definition of macro Bruce Richardson
2025-03-27 14:51   ` [PATCH v3 4/9] net/ixgbe/base: fix compilation warnings Bruce Richardson
2025-03-27 14:51   ` [PATCH v3 5/9] net/ixgbe/base: fix lock checker errors Bruce Richardson
2025-03-28  8:20     ` David Marchand
2025-03-28 10:43       ` Bruce Richardson
2025-03-28 11:13         ` Bruce Richardson
2025-03-28 11:48         ` David Marchand
2025-03-27 14:51   ` [PATCH v3 6/9] net/i40e/base: fix unused value warnings Bruce Richardson
2025-03-27 14:51   ` [PATCH v3 7/9] net/i40e/base: fix compiler warnings Bruce Richardson
2025-03-27 14:52   ` [PATCH v3 8/9] net/ice/base: reduce warnings for unused variables Bruce Richardson
2025-03-27 14:52   ` [PATCH v3 9/9] net/intel: simplify base code builds Bruce Richardson
2025-03-28  8:21   ` [PATCH v3 0/9] net/intel: clean up base code build David Marchand
2025-03-28  9:01     ` Bruce Richardson
2025-03-28 11:16 ` [PATCH v4 " Bruce Richardson
2025-03-28 11:16   ` [PATCH v4 1/9] net/fm10k/base: fix compilation warnings Bruce Richardson
2025-03-28 12:53     ` Burakov, Anatoly
2025-03-28 11:16   ` [PATCH v4 2/9] net/iavf/base: remove unused meson.build file Bruce Richardson
2025-03-28 13:00     ` Burakov, Anatoly
2025-03-28 11:16   ` [PATCH v4 3/9] net/ixgbe/base: correct definition of macro Bruce Richardson
2025-03-28 13:01     ` Burakov, Anatoly
2025-03-28 11:16   ` [PATCH v4 4/9] net/ixgbe/base: fix compilation warnings Bruce Richardson
2025-03-28 13:02     ` Burakov, Anatoly
2025-03-28 11:16   ` [PATCH v4 5/9] net/ixgbe/base: fix lock checker errors Bruce Richardson
2025-03-28 13:05     ` Burakov, Anatoly
2025-03-28 11:16   ` [PATCH v4 6/9] net/i40e/base: fix unused value warnings Bruce Richardson
2025-03-28 13:07     ` Burakov, Anatoly
2025-03-28 15:21       ` Andre Muezerie
2025-03-28 15:26         ` Bruce Richardson
2025-03-28 11:16   ` [PATCH v4 7/9] net/i40e/base: fix compiler warnings Bruce Richardson
2025-03-28 13:08     ` Burakov, Anatoly
2025-03-28 11:16   ` Bruce Richardson [this message]
2025-03-28 13:09     ` [PATCH v4 8/9] net/ice/base: reduce warnings for unused variables Burakov, Anatoly
2025-03-28 11:16   ` [PATCH v4 9/9] net/intel: simplify base code builds Bruce Richardson
2025-03-28 13:09     ` Burakov, Anatoly
2025-03-28 16:05   ` [PATCH v4 0/9] net/intel: clean up base code build Bruce Richardson

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=20250328111621.2665257-9-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=vladimir.medvedkin@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).