dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] fix unused-but-set-global warnings
@ 2026-08-26 23:43 Stephen Hemminger
  2026-08-26 23:43 ` [PATCH 1/4] common/dpaax: fix unused variable warning in non-debug build Stephen Hemminger
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Stephen Hemminger @ 2026-08-26 23:43 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

  Clang 23 adds -Wunused-but-set-global, which reports file scope
  variables that are assigned but never read. It is enabled by -Wall and
  does not appear with gcc or with clang 20 through 22.

  Three of these are dead variables and are simply removed. The fourth,
  'alive' in dpaa_of.c, is a real debug aid: it is only read by
  DPAAX_HWWARN, which discards its condition when RTE_LIBRTE_DPAAX_DEBUG
  is not defined. That one is fixed by making the empty expansion consume
  its argument, which keeps the condition compiled in both builds and
  covers every other DPAAX_HWWARN user as well.

  The patches are independent and touch four unrelated drivers.

Stephen Hemminger (4):
  common/dpaax: fix unused variable warning in non-debug build
  bus/dpaa: remove unused qman_clk variable
  common/zsda: remove unused device counter
  net/qede: remove unused app version variable

 drivers/bus/dpaa/base/qbman/qman_driver.c | 4 ----
 drivers/common/dpaax/dpaax_logs.h         | 3 ++-
 drivers/common/zsda/zsda_device.c         | 5 -----
 drivers/net/qede/qede_debug.c             | 9 ---------
 4 files changed, 2 insertions(+), 19 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/4] common/dpaax: fix unused variable warning in non-debug build
  2026-08-26 23:43 [PATCH 0/4] fix unused-but-set-global warnings Stephen Hemminger
@ 2026-08-26 23:43 ` Stephen Hemminger
  2026-08-27  9:07   ` David Marchand
  2026-08-26 23:43 ` [PATCH 2/4] bus/dpaa: remove unused qman_clk variable Stephen Hemminger
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Stephen Hemminger @ 2026-08-26 23:43 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, stable, Hemant Agrawal, Sachin Saxena

Fix compiler warning on clang-23.

  dpaa_of.c:14:12: warning: variable 'alive' set but not used
        [-Wunused-but-set-global]

The 'alive' flag is only read by DPAAX_HWWARN, which expands to an empty
statement and discards its condition unless RTE_LIBRTE_DPAAX_DEBUG is
defined. Make the empty expansion consume its argument so the condition
is still checked in a non-debug build.

Fixes: 8c83f28cc8a4 ("common/dpaax: move OF library from DPAA bus")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/common/dpaax/dpaax_logs.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/common/dpaax/dpaax_logs.h b/drivers/common/dpaax/dpaax_logs.h
index 90f0c98863..431a16f45a 100644
--- a/drivers/common/dpaax/dpaax_logs.h
+++ b/drivers/common/dpaax/dpaax_logs.h
@@ -5,6 +5,7 @@
 #ifndef _DPAAX_LOGS_H_
 #define _DPAAX_LOGS_H_
 
+#include <rte_common.h>
 #include <rte_log.h>
 
 extern int dpaax_logger;
@@ -17,7 +18,7 @@ extern int dpaax_logger;
 			DPAAX_LOG(DEBUG, "WARN: " fmt, ##__VA_ARGS__); \
 	} while (0)
 #else
-#define DPAAX_HWWARN(cond, fmt, ...) do { } while (0)
+#define DPAAX_HWWARN(cond, fmt, ...) do { RTE_SET_USED(cond); } while (0)
 #endif
 
 #define DPAAX_LOG(level, ...) \
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/4] bus/dpaa: remove unused qman_clk variable
  2026-08-26 23:43 [PATCH 0/4] fix unused-but-set-global warnings Stephen Hemminger
  2026-08-26 23:43 ` [PATCH 1/4] common/dpaax: fix unused variable warning in non-debug build Stephen Hemminger
@ 2026-08-26 23:43 ` Stephen Hemminger
  2026-08-27 15:57   ` Hemant Agrawal
  2026-08-26 23:43 ` [PATCH 3/4] common/zsda: remove unused device counter Stephen Hemminger
  2026-08-26 23:43 ` [PATCH 4/4] net/qede: remove unused app version variable Stephen Hemminger
  3 siblings, 1 reply; 11+ messages in thread
From: Stephen Hemminger @ 2026-08-26 23:43 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, stable, Hemant Agrawal, Sachin Saxena,
	Geoff Thorpe, Shreyansh Jain, Roy Pledge

The driver was recording the clock frequency and never using it.

clang 23 reports:

  qman_driver.c:27:12: warning: variable 'qman_clk' set but not used
        [-Wunused-but-set-global]

Remove the variable and the dead store.

Fixes: f6fadc3e6310 ("bus/dpaa: add QMAN interface driver")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/bus/dpaa/base/qbman/qman_driver.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c
index 45b094e0c6..bbe2640c52 100644
--- a/drivers/bus/dpaa/base/qbman/qman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/qman_driver.c
@@ -23,8 +23,6 @@ u16 qm_channel_pme = QMAN_CHANNEL_PME;
 
 /* Ccsr map address to access ccsrbased register */
 static void *qman_ccsr_map;
-/* The qman clock frequency */
-static u32 qman_clk;
 
 static __thread int qmfd = -1;
 static __thread struct qm_portal_config qpcfg;
@@ -371,8 +369,6 @@ int qman_global_init(void)
 	clk = of_get_property(dt_node, "clock-frequency", NULL);
 	if (!clk)
 		pr_warn("Can't find Qman clock frequency\n");
-	else
-		qman_clk = be32_to_cpu(*clk);
 
 #ifdef CONFIG_FSL_QMAN_FQ_LOOKUP
 	return qman_setup_fq_lookup_table(CONFIG_FSL_QMAN_FQ_LOOKUP_MAX);
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/4] common/zsda: remove unused device counter
  2026-08-26 23:43 [PATCH 0/4] fix unused-but-set-global warnings Stephen Hemminger
  2026-08-26 23:43 ` [PATCH 1/4] common/dpaax: fix unused variable warning in non-debug build Stephen Hemminger
  2026-08-26 23:43 ` [PATCH 2/4] bus/dpaa: remove unused qman_clk variable Stephen Hemminger
@ 2026-08-26 23:43 ` Stephen Hemminger
  2026-08-26 23:43 ` [PATCH 4/4] net/qede: remove unused app version variable Stephen Hemminger
  3 siblings, 0 replies; 11+ messages in thread
From: Stephen Hemminger @ 2026-08-26 23:43 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, stable, Chengfei Han, Ming Ran, Hanxiao Li,
	Akhil Goyal

zsda_nb_pci_devices is incremented when a PCI device is allocated and
decremented when it is released, but the count is never read.

clang 23 reports:

  zsda_device.c:10:12: warning: variable 'zsda_nb_pci_devices' set but
        not used [-Wunused-but-set-global]

Remove the counter and the three sites that update it.

Fixes: 6592da5893d3 ("common/zsda: add base driver")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/common/zsda/zsda_device.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/common/zsda/zsda_device.c b/drivers/common/zsda/zsda_device.c
index 72f017c699..280a51f9b3 100644
--- a/drivers/common/zsda/zsda_device.c
+++ b/drivers/common/zsda/zsda_device.c
@@ -7,7 +7,6 @@
 
 /* per-process array of device data */
 struct zsda_device_info zsda_devs[RTE_PMD_ZSDA_MAX_PCI_DEVICES];
-static int zsda_nb_pci_devices;
 
 /*
  * The set of PCI devices this driver supports
@@ -85,7 +84,6 @@ zsda_pci_device_allocate(struct rte_pci_device *pci_dev)
 		zsda_pci_dev = mz->addr;
 		zsda_devs[zsda_pci_dev->zsda_dev_id].mz = mz;
 		zsda_devs[zsda_pci_dev->zsda_dev_id].pci_dev = pci_dev;
-		zsda_nb_pci_devices++;
 		return zsda_pci_dev;
 	}
 
@@ -114,8 +112,6 @@ zsda_pci_device_allocate(struct rte_pci_device *pci_dev)
 	zsda_pci_dev->pci_dev = pci_dev;
 	zsda_devs[zsda_dev_id].pci_dev = pci_dev;
 
-	zsda_nb_pci_devices++;
-
 	return zsda_pci_dev;
 }
 
@@ -141,7 +137,6 @@ zsda_pci_device_release(const struct rte_pci_device *pci_dev)
 			rte_memzone_free(inst->mz);
 
 		memset(inst, 0, sizeof(struct zsda_device_info));
-		zsda_nb_pci_devices--;
 	}
 	return 0;
 }
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/4] net/qede: remove unused app version variable
  2026-08-26 23:43 [PATCH 0/4] fix unused-but-set-global warnings Stephen Hemminger
                   ` (2 preceding siblings ...)
  2026-08-26 23:43 ` [PATCH 3/4] common/zsda: remove unused device counter Stephen Hemminger
@ 2026-08-26 23:43 ` Stephen Hemminger
  2026-08-27  9:08   ` David Marchand
  3 siblings, 1 reply; 11+ messages in thread
From: Stephen Hemminger @ 2026-08-26 23:43 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, stable, Devendra Singh Rawat, Alok Prasad,
	Rasesh Mody, Igor Russkikh

qed_dbg_set_app_ver() validates the caller's version and stores it.
But the variable s_app_ver is never used in DPDK driver.

clang 23 reports:

  qede_debug.c:820:12: warning: variable 's_app_ver' set but not used
        [-Wunused-but-set-global]

Remove the variable and the dead store.

Fixes: ec55c118792b ("net/qede: add infrastructure for debug data collection")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/qede/qede_debug.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/net/qede/qede_debug.c b/drivers/net/qede/qede_debug.c
index 1d3147b724..8afaa5c108 100644
--- a/drivers/net/qede/qede_debug.c
+++ b/drivers/net/qede/qede_debug.c
@@ -812,13 +812,6 @@ static struct split_type_defs s_split_type_defs[] = {
 	{"vf"}
 };
 
-/******************************** Variables *********************************/
-
-/**
- * The version of the calling app
- */
-static u32 s_app_ver;
-
 /**************************** Private Functions ******************************/
 
 /* Reads and returns a single dword from the specified unaligned buffer */
@@ -4869,8 +4862,6 @@ enum dbg_status qed_dbg_set_app_ver(u32 ver)
 	if (ver < TOOLS_VERSION)
 		return DBG_STATUS_UNSUPPORTED_APP_VERSION;
 
-	s_app_ver = ver;
-
 	return DBG_STATUS_OK;
 }
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] common/dpaax: fix unused variable warning in non-debug build
  2026-08-26 23:43 ` [PATCH 1/4] common/dpaax: fix unused variable warning in non-debug build Stephen Hemminger
@ 2026-08-27  9:07   ` David Marchand
  2026-08-27 14:57     ` Stephen Hemminger
  0 siblings, 1 reply; 11+ messages in thread
From: David Marchand @ 2026-08-27  9:07 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, stable, Hemant Agrawal, Sachin Saxena

On Thu, 27 Aug 2026 at 02:00, Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> Fix compiler warning on clang-23.
>
>   dpaa_of.c:14:12: warning: variable 'alive' set but not used
>         [-Wunused-but-set-global]
>
> The 'alive' flag is only read by DPAAX_HWWARN, which expands to an empty
> statement and discards its condition unless RTE_LIBRTE_DPAAX_DEBUG is
> defined. Make the empty expansion consume its argument so the condition
> is still checked in a non-debug build.
>
> Fixes: 8c83f28cc8a4 ("common/dpaax: move OF library from DPAA bus")

Not that important, the issue probably predates this commit.
And looking at this change, it seems DPAA_BUS_HWWARN is dead code since then.


> Cc: stable@dpdk.org
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Otherwise lgtm.



-- 
David Marchand


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] net/qede: remove unused app version variable
  2026-08-26 23:43 ` [PATCH 4/4] net/qede: remove unused app version variable Stephen Hemminger
@ 2026-08-27  9:08   ` David Marchand
  2026-08-27 14:59     ` Stephen Hemminger
  0 siblings, 1 reply; 11+ messages in thread
From: David Marchand @ 2026-08-27  9:08 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: dev, stable, Devendra Singh Rawat, Alok Prasad, Rasesh Mody,
	Igor Russkikh

On Thu, 27 Aug 2026 at 02:00, Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> qed_dbg_set_app_ver() validates the caller's version and stores it.
> But the variable s_app_ver is never used in DPDK driver.
>
> clang 23 reports:
>
>   qede_debug.c:820:12: warning: variable 's_app_ver' set but not used
>         [-Wunused-but-set-global]
>
> Remove the variable and the dead store.

Maybe go one step further?
qed_dbg_set_app_ver() looks useless.

>
> Fixes: ec55c118792b ("net/qede: add infrastructure for debug data collection")
> Cc: stable@dpdk.org
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] common/dpaax: fix unused variable warning in non-debug build
  2026-08-27  9:07   ` David Marchand
@ 2026-08-27 14:57     ` Stephen Hemminger
  2026-08-27 15:55       ` Hemant Agrawal
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Hemminger @ 2026-08-27 14:57 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, stable, Hemant Agrawal, Sachin Saxena

On Thu, 27 Aug 2026 11:07:50 +0200
David Marchand <david.marchand@redhat.com> wrote:

> On Thu, 27 Aug 2026 at 02:00, Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > Fix compiler warning on clang-23.
> >
> >   dpaa_of.c:14:12: warning: variable 'alive' set but not used
> >         [-Wunused-but-set-global]
> >
> > The 'alive' flag is only read by DPAAX_HWWARN, which expands to an empty
> > statement and discards its condition unless RTE_LIBRTE_DPAAX_DEBUG is
> > defined. Make the empty expansion consume its argument so the condition
> > is still checked in a non-debug build.
> >
> > Fixes: 8c83f28cc8a4 ("common/dpaax: move OF library from DPAA bus")  
> 
> Not that important, the issue probably predates this commit.
> And looking at this change, it seems DPAA_BUS_HWWARN is dead code since then.

That is when the device-tree warning was added.
The history scan looks right.

It seems like it should either be removed as irrelevant or made into
a regular warning. But that is up to Hemant and Sachin to decide;
I just want clean builds for now.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] net/qede: remove unused app version variable
  2026-08-27  9:08   ` David Marchand
@ 2026-08-27 14:59     ` Stephen Hemminger
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Hemminger @ 2026-08-27 14:59 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, stable, Devendra Singh Rawat, Alok Prasad, Rasesh Mody,
	Igor Russkikh

On Thu, 27 Aug 2026 11:08:07 +0200
David Marchand <david.marchand@redhat.com> wrote:

> On Thu, 27 Aug 2026 at 02:00, Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > qed_dbg_set_app_ver() validates the caller's version and stores it.
> > But the variable s_app_ver is never used in DPDK driver.
> >
> > clang 23 reports:
> >
> >   qede_debug.c:820:12: warning: variable 's_app_ver' set but not used
> >         [-Wunused-but-set-global]
> >
> > Remove the variable and the dead store.  
> 
> Maybe go one step further?
> qed_dbg_set_app_ver() looks useless.

Yes it is useless code. Looks like inherited from Linux driver.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] common/dpaax: fix unused variable warning in non-debug build
  2026-08-27 14:57     ` Stephen Hemminger
@ 2026-08-27 15:55       ` Hemant Agrawal
  0 siblings, 0 replies; 11+ messages in thread
From: Hemant Agrawal @ 2026-08-27 15:55 UTC (permalink / raw)
  To: Stephen Hemminger, David Marchand
  Cc: dev, stable, Hemant Agrawal, Sachin Saxena

[-- Attachment #1: Type: text/plain, Size: 1260 bytes --]


On 27-08-2026 20:27, Stephen Hemminger wrote:
> On Thu, 27 Aug 2026 11:07:50 +0200
> David Marchand<david.marchand@redhat.com> wrote:
>
>> On Thu, 27 Aug 2026 at 02:00, Stephen Hemminger
>> <stephen@networkplumber.org> wrote:
>>> Fix compiler warning on clang-23.
>>>
>>>    dpaa_of.c:14:12: warning: variable 'alive' set but not used
>>>          [-Wunused-but-set-global]
>>>
>>> The 'alive' flag is only read by DPAAX_HWWARN, which expands to an empty
>>> statement and discards its condition unless RTE_LIBRTE_DPAAX_DEBUG is
>>> defined. Make the empty expansion consume its argument so the condition
>>> is still checked in a non-debug build.
>>>
>>> Fixes: 8c83f28cc8a4 ("common/dpaax: move OF library from DPAA bus")
>> Not that important, the issue probably predates this commit.
>> And looking at this change, it seems DPAA_BUS_HWWARN is dead code since then.
> That is when the device-tree warning was added.
> The history scan looks right.
>
> It seems like it should either be removed as irrelevant or made into
> a regular warning. But that is up to Hemant and Sachin to decide;
> I just want clean builds for now.We need to remove this define.
We will plan to remove this definition in future.

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

[-- Attachment #2: Type: text/html, Size: 2334 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/4] bus/dpaa: remove unused qman_clk variable
  2026-08-26 23:43 ` [PATCH 2/4] bus/dpaa: remove unused qman_clk variable Stephen Hemminger
@ 2026-08-27 15:57   ` Hemant Agrawal
  0 siblings, 0 replies; 11+ messages in thread
From: Hemant Agrawal @ 2026-08-27 15:57 UTC (permalink / raw)
  To: Stephen Hemminger, dev
  Cc: stable, Hemant Agrawal, Sachin Saxena, Geoff Thorpe,
	Shreyansh Jain, Roy Pledge

[-- Attachment #1: Type: text/plain, Size: 116 bytes --]

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>return 
qman_setup_fq_lookup_table(CONFIG_FSL_QMAN_FQ_LOOKUP_MAX);

[-- Attachment #2: Type: text/html, Size: 384 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-08-27 15:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-26 23:43 [PATCH 0/4] fix unused-but-set-global warnings Stephen Hemminger
2026-08-26 23:43 ` [PATCH 1/4] common/dpaax: fix unused variable warning in non-debug build Stephen Hemminger
2026-08-27  9:07   ` David Marchand
2026-08-27 14:57     ` Stephen Hemminger
2026-08-27 15:55       ` Hemant Agrawal
2026-08-26 23:43 ` [PATCH 2/4] bus/dpaa: remove unused qman_clk variable Stephen Hemminger
2026-08-27 15:57   ` Hemant Agrawal
2026-08-26 23:43 ` [PATCH 3/4] common/zsda: remove unused device counter Stephen Hemminger
2026-08-26 23:43 ` [PATCH 4/4] net/qede: remove unused app version variable Stephen Hemminger
2026-08-27  9:08   ` David Marchand
2026-08-27 14:59     ` Stephen Hemminger

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).