[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c66c2aa1-62fd-4da8-b69e-a845ab955851@kernel.org>
Date: Thu, 6 Feb 2025 08:45:14 +0100
From: Jiri Slaby <jirislaby@...nel.org>
To: Simon Horman <horms@...nel.org>,
Przemek Kitszel <przemyslaw.kitszel@...el.com>
Cc: intel-wired-lan@...ts.osuosl.org, Tony Nguyen
<anthony.l.nguyen@...el.com>, netdev@...r.kernel.org,
Konrad Knitter <konrad.knitter@...el.com>,
Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>,
Qiuxu Zhuo <qiuxu.zhuo@...el.com>,
Linus Torvalds <torvalds@...ux-foundation.org>, Kees Cook <kees@...nel.org>,
Nick Desaulniers <nick.desaulniers@...il.com>
Subject: Re: [PATCH iwl-net] ice: health.c: fix compilation on gcc 7.5
On 05. 02. 25, 21:45, Simon Horman wrote:
> + Jiri
>
> On Wed, Feb 05, 2025 at 11:42:12AM +0100, Przemek Kitszel wrote:
>> GCC 7 is not as good as GCC 8+ in telling what is a compile-time const,
>> and thus could be used for static storage. So we could not use variables
>> for that, no matter how much "const" keyword is sprinkled around.
>>
>> Excerpt from the report:
>> My GCC is: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0.
>>
>> CC [M] drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.o
>> drivers/net/ethernet/intel/ice/devlink/health.c:35:3: error: initializer element is not constant
>> ice_common_port_solutions, {ice_port_number_label}},
>> ^~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/devlink/health.c:35:3: note: (near initialization for 'ice_health_status_lookup[0].solution')
>> drivers/net/ethernet/intel/ice/devlink/health.c:35:31: error: initializer element is not constant
>> ice_common_port_solutions, {ice_port_number_label}},
>> ^~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/devlink/health.c:35:31: note: (near initialization for 'ice_health_status_lookup[0].data_label[0]')
>> drivers/net/ethernet/intel/ice/devlink/health.c:37:46: error: initializer element is not constant
>> "Change or replace the module or cable.", {ice_port_number_label}},
>> ^~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/intel/ice/devlink/health.c:37:46: note: (near initialization for 'ice_health_status_lookup[1].data_label[0]')
>> drivers/net/ethernet/intel/ice/devlink/health.c:39:3: error: initializer element is not constant
>> ice_common_port_solutions, {ice_port_number_label}},
>> ^~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> Fixes: 85d6164ec56d ("ice: add fw and port health reporters")
>> Reported-by: Qiuxu Zhuo <qiuxu.zhuo@...el.com>
>> Closes: https://lore.kernel.org/netdev/CY8PR11MB7134BF7A46D71E50D25FA7A989F72@CY8PR11MB7134.namprd11.prod.outlook.com
>> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>
>> ---
>> I would really like to bump min gcc to 8.5 (RH 8 family),
>> instead of supporting old Ubuntu. However SLES 15 is also stuck with gcc 7.5 :(
>>
>> CC: Linus Torvalds <torvalds@...ux-foundation.org>
>> CC: Kees Cook <kees@...nel.org>
>> CC: Nick Desaulniers <nick.desaulniers@...il.com>
>
> Hi Prezemek,
>
> I ran into a similar problem not so long ago and I'm wondering if
> the following, based on a suggestion by Jiri Slaby, resolves your
> problem.
>
> diff --git a/drivers/net/ethernet/intel/ice/devlink/health.c b/drivers/net/ethernet/intel/ice/devlink/health.c
> index ea40f7941259..19c3d37aa768 100644
> --- a/drivers/net/ethernet/intel/ice/devlink/health.c
> +++ b/drivers/net/ethernet/intel/ice/devlink/health.c
> @@ -25,10 +25,10 @@ struct ice_health_status {
> * The below lookup requires to be sorted by code.
> */
>
> -static const char *const ice_common_port_solutions =
> +static const char ice_common_port_solutions[] =
> "Check your cable connection. Change or replace the module or cable. Manually set speed and duplex.";
> -static const char *const ice_port_number_label = "Port Number";
> -static const char *const ice_update_nvm_solution = "Update to the latest NVM image.";
> +static const char ice_port_number_label[] = "Port Number";
> +static const char ice_update_nvm_solution[] = "Update to the latest NVM image.";
Indeed, no reason to create an (unused) pointer.
And no, don't use macros for strings.
thanks,
--
js
suse labs
Powered by blists - more mailing lists