Skip to contentSkip to conversation

igc: remove unused igc_priv_flags_strings array

PATCH In review Arnd Bergmann 3 participants 3 messages Mar 7, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igc: remove unused igc_priv_flags_strings array

clang points out that the igc_priv_flags_strings[] array is never referenced, aside from being used for calculating its length:

drivers/net/ethernet/intel/igc/igc_ethtool.c:9:19: error: variable 'igc_priv_flags_strings' is not needed and will not
be emitted [-Werror,-Wunneeded-internal-declaration]
static const char igc_priv_flags_strings[][ETH_GSTRING_LEN] = {

A similar array is present in several other intel ethernet drivers, but all the others use it in their .get_strings() callback, which igc does not implement (yet).

Probably it should be implemented, but as I have no way of testing it, this does the simpler alternative of removing the array to get rid of the warning.

Fixes 8c5ad0dae93c ("igc: Add ethtool support")
---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/intel/igc/igc_ethtool.c +1 -4
index eff37a6c0afa..9e352c2be644 100644
@@ -6,12 +6,9 @@
 
 #include "igc.h"
 
-static const char igc_priv_flags_strings[][ETH_GSTRING_LEN] = {
 #define IGC_PRIV_FLAGS_LEGACY_RX	BIT(0)
-	"legacy-rx",
-};
 
-#define IGC_PRIV_FLAGS_STR_LEN ARRAY_SIZE(igc_priv_flags_strings)
+#define IGC_PRIV_FLAGS_STR_LEN		1
 
 static void igc_get_drvinfo(struct net_device *netdev,
 			    struct ethtool_drvinfo *drvinfo)
Signature · 1 line
2.20.0
maintainer
#1 lore raw

From: Arnd Bergmann <[email protected]>
Date: Thu, 7 Mar 2019 10:29:57 +0100

Quoted 11 lines

clang points out that the igc_priv_flags_strings[] array is never referenced, aside from being used for calculating its length:

drivers/net/ethernet/intel/igc/igc_ethtool.c:9:19: error: variable 'igc_priv_flags_strings' is not needed and will not
be emitted [-Werror,-Wunneeded-internal-declaration]
static const char igc_priv_flags_strings[][ETH_GSTRING_LEN] = {

A similar array is present in several other intel ethernet drivers, but all the others use it in their .get_strings() callback, which igc does not implement (yet).

Quoted 6 lines

Probably it should be implemented, but as I have no way of testing it, this does the simpler alternative of removing the array to get rid of the warning.

Fixes 8c5ad0dae93c ("igc: Add ethtool support")

Jeff, I assume you will pick this up.

#2 lore raw
Quoted 14 lines · David Miller

From: Arnd Bergmann <[email protected]>
Date: Thu, 7 Mar 2019 10:29:57 +0100

Quoted 11 lines

clang points out that the igc_priv_flags_strings[] array is never referenced, aside from being used for calculating its length:

drivers/net/ethernet/intel/igc/igc_ethtool.c:9:19: error: variable 'igc_priv_flags_strings' is not needed and will not
be emitted [-Werror,-Wunneeded-internal-declaration]
static const char igc_priv_flags_strings[][ETH_GSTRING_LEN] = {

A similar array is present in several other intel ethernet drivers, but all the others use it in their .get_strings() callback, which igc does not implement (yet).

Quoted 9 lines
Quoted 6 lines

Probably it should be implemented, but as I have no way of testing it, this does the simpler alternative of removing the array to get rid of the warning.

Fixes 8c5ad0dae93c ("igc: Add ethtool support")

Jeff, I assume you will pick this up.

I've submitted igc: Add support for statistics commit 7aa2547613233a232b9b2e1942d67da4997e6ad0. This patch in Jeff's Kirsher next-queue and used igc_priv_flags_strings.
Thanks,
Sasha