Skip to content

Commit 152c719

Browse files
hormssmb49
authored andcommitted
net: stmmac: xgmac: use #define for string constants
BugLink: https://bugs.launchpad.net/bugs/2059991 commit 1692b97 upstream. The cited commit introduces and uses the string constants dpp_tx_err and dpp_rx_err. These are assigned to constant fields of the array dwxgmac3_error_desc. It has been reported that on GCC 6 and 7.5.0 this results in warnings such as: .../dwxgmac2_core.c:836:20: error: initialiser element is not constant { true, "TDPES0", dpp_tx_err }, I have been able to reproduce this using: GCC 7.5.0, 8.4.0, 9.4.0 and 10.5.0. But not GCC 13.2.0. So it seems this effects older compilers but not newer ones. As Jon points out in his report, the minimum compiler supported by the kernel is GCC 5.1, so it does seem that this ought to be fixed. It is not clear to me what combination of 'const', if any, would address this problem. So this patch takes of using #defines for the string constants Compile tested only. Fixes: 46eba19 ("net: stmmac: xgmac: fix handling of DPP safety error for DMA channels") Reported-by: Jon Hunter <jonathanh@nvidia.com> Closes: https://lore.kernel.org/netdev/c25eb595-8d91-40ea-9f52-efa15ebafdbc@nvidia.com/ Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202402081135.lAxxBXHk-lkp@intel.com/ Signed-off-by: Simon Horman <horms@kernel.org> Link: https://lore.kernel.org/r/20240208-xgmac-const-v1-1-e69a1eeabfc8@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Portia Stephens <portia.stephens@canonical.com> Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
1 parent bba5af8 commit 152c719

File tree

1 file changed

+35
-34
lines changed

1 file changed

+35
-34
lines changed

drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -792,41 +792,42 @@ static const struct dwxgmac3_error_desc dwxgmac3_dma_errors[32]= {
792792
{ false, "UNKNOWN", "Unknown Error" }, /* 31 */
793793
};
794794

795-
static const char * const dpp_rx_err = "Read Rx Descriptor Parity checker Error";
796-
static const char * const dpp_tx_err = "Read Tx Descriptor Parity checker Error";
795+
#define DPP_RX_ERR "Read Rx Descriptor Parity checker Error"
796+
#define DPP_TX_ERR "Read Tx Descriptor Parity checker Error"
797+
797798
static const struct dwxgmac3_error_desc dwxgmac3_dma_dpp_errors[32] = {
798-
{ true, "TDPES0", dpp_tx_err },
799-
{ true, "TDPES1", dpp_tx_err },
800-
{ true, "TDPES2", dpp_tx_err },
801-
{ true, "TDPES3", dpp_tx_err },
802-
{ true, "TDPES4", dpp_tx_err },
803-
{ true, "TDPES5", dpp_tx_err },
804-
{ true, "TDPES6", dpp_tx_err },
805-
{ true, "TDPES7", dpp_tx_err },
806-
{ true, "TDPES8", dpp_tx_err },
807-
{ true, "TDPES9", dpp_tx_err },
808-
{ true, "TDPES10", dpp_tx_err },
809-
{ true, "TDPES11", dpp_tx_err },
810-
{ true, "TDPES12", dpp_tx_err },
811-
{ true, "TDPES13", dpp_tx_err },
812-
{ true, "TDPES14", dpp_tx_err },
813-
{ true, "TDPES15", dpp_tx_err },
814-
{ true, "RDPES0", dpp_rx_err },
815-
{ true, "RDPES1", dpp_rx_err },
816-
{ true, "RDPES2", dpp_rx_err },
817-
{ true, "RDPES3", dpp_rx_err },
818-
{ true, "RDPES4", dpp_rx_err },
819-
{ true, "RDPES5", dpp_rx_err },
820-
{ true, "RDPES6", dpp_rx_err },
821-
{ true, "RDPES7", dpp_rx_err },
822-
{ true, "RDPES8", dpp_rx_err },
823-
{ true, "RDPES9", dpp_rx_err },
824-
{ true, "RDPES10", dpp_rx_err },
825-
{ true, "RDPES11", dpp_rx_err },
826-
{ true, "RDPES12", dpp_rx_err },
827-
{ true, "RDPES13", dpp_rx_err },
828-
{ true, "RDPES14", dpp_rx_err },
829-
{ true, "RDPES15", dpp_rx_err },
799+
{ true, "TDPES0", DPP_TX_ERR },
800+
{ true, "TDPES1", DPP_TX_ERR },
801+
{ true, "TDPES2", DPP_TX_ERR },
802+
{ true, "TDPES3", DPP_TX_ERR },
803+
{ true, "TDPES4", DPP_TX_ERR },
804+
{ true, "TDPES5", DPP_TX_ERR },
805+
{ true, "TDPES6", DPP_TX_ERR },
806+
{ true, "TDPES7", DPP_TX_ERR },
807+
{ true, "TDPES8", DPP_TX_ERR },
808+
{ true, "TDPES9", DPP_TX_ERR },
809+
{ true, "TDPES10", DPP_TX_ERR },
810+
{ true, "TDPES11", DPP_TX_ERR },
811+
{ true, "TDPES12", DPP_TX_ERR },
812+
{ true, "TDPES13", DPP_TX_ERR },
813+
{ true, "TDPES14", DPP_TX_ERR },
814+
{ true, "TDPES15", DPP_TX_ERR },
815+
{ true, "RDPES0", DPP_RX_ERR },
816+
{ true, "RDPES1", DPP_RX_ERR },
817+
{ true, "RDPES2", DPP_RX_ERR },
818+
{ true, "RDPES3", DPP_RX_ERR },
819+
{ true, "RDPES4", DPP_RX_ERR },
820+
{ true, "RDPES5", DPP_RX_ERR },
821+
{ true, "RDPES6", DPP_RX_ERR },
822+
{ true, "RDPES7", DPP_RX_ERR },
823+
{ true, "RDPES8", DPP_RX_ERR },
824+
{ true, "RDPES9", DPP_RX_ERR },
825+
{ true, "RDPES10", DPP_RX_ERR },
826+
{ true, "RDPES11", DPP_RX_ERR },
827+
{ true, "RDPES12", DPP_RX_ERR },
828+
{ true, "RDPES13", DPP_RX_ERR },
829+
{ true, "RDPES14", DPP_RX_ERR },
830+
{ true, "RDPES15", DPP_RX_ERR },
830831
};
831832

832833
static void dwxgmac3_handle_dma_err(struct net_device *ndev,

0 commit comments

Comments
 (0)