2024-06-05 05:27:06

by Dan Carpenter

[permalink] [raw]
Subject: Re: [net v2 PATCH] net: stmmac: Update CBS parameters when speed changes after linking up

Hi Xiaolei,

kernel test robot noticed the following build warnings:

url: https://github.com/intel-lab-lkp/linux/commits/Xiaolei-Wang/net-stmmac-Update-CBS-parameters-when-speed-changes-after-linking-up/20240530-141843
base: net/main
patch link: https://lore.kernel.org/r/20240530061453.561708-1-xiaolei.wang%40windriver.com
patch subject: [net v2 PATCH] net: stmmac: Update CBS parameters when speed changes after linking up
config: i386-randconfig-141-20240604 (https://download.01.org/0day-ci/archive/20240605/[email protected]/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

New smatch warnings:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3234 stmmac_configure_cbs() error: uninitialized symbol 'ptr'.
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3234 stmmac_configure_cbs() error: uninitialized symbol 'speed_div'.

vim +/ptr +3234 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

19d9187317979c Joao Pinto 2017-03-10 3194 static void stmmac_configure_cbs(struct stmmac_priv *priv)
19d9187317979c Joao Pinto 2017-03-10 3195 {
19d9187317979c Joao Pinto 2017-03-10 3196 u32 tx_queues_count = priv->plat->tx_queues_to_use;
19d9187317979c Joao Pinto 2017-03-10 3197 u32 mode_to_use;
19d9187317979c Joao Pinto 2017-03-10 3198 u32 queue;
882212f550d669 Xiaolei Wang 2024-05-30 3199 u32 ptr, speed_div;
882212f550d669 Xiaolei Wang 2024-05-30 3200 u64 value;
882212f550d669 Xiaolei Wang 2024-05-30 3201
882212f550d669 Xiaolei Wang 2024-05-30 3202 /* Port Transmit Rate and Speed Divider */
882212f550d669 Xiaolei Wang 2024-05-30 3203 switch (priv->speed) {
882212f550d669 Xiaolei Wang 2024-05-30 3204 case SPEED_10000:
882212f550d669 Xiaolei Wang 2024-05-30 3205 ptr = 32;
882212f550d669 Xiaolei Wang 2024-05-30 3206 speed_div = 10000000;
882212f550d669 Xiaolei Wang 2024-05-30 3207 break;
882212f550d669 Xiaolei Wang 2024-05-30 3208 case SPEED_5000:
882212f550d669 Xiaolei Wang 2024-05-30 3209 ptr = 32;
882212f550d669 Xiaolei Wang 2024-05-30 3210 speed_div = 5000000;
882212f550d669 Xiaolei Wang 2024-05-30 3211 break;
882212f550d669 Xiaolei Wang 2024-05-30 3212 case SPEED_2500:
882212f550d669 Xiaolei Wang 2024-05-30 3213 ptr = 8;
882212f550d669 Xiaolei Wang 2024-05-30 3214 speed_div = 2500000;
882212f550d669 Xiaolei Wang 2024-05-30 3215 break;
882212f550d669 Xiaolei Wang 2024-05-30 3216 case SPEED_1000:
882212f550d669 Xiaolei Wang 2024-05-30 3217 ptr = 8;
882212f550d669 Xiaolei Wang 2024-05-30 3218 speed_div = 1000000;
882212f550d669 Xiaolei Wang 2024-05-30 3219 break;
882212f550d669 Xiaolei Wang 2024-05-30 3220 case SPEED_100:
882212f550d669 Xiaolei Wang 2024-05-30 3221 ptr = 4;
882212f550d669 Xiaolei Wang 2024-05-30 3222 speed_div = 100000;
882212f550d669 Xiaolei Wang 2024-05-30 3223 break;
882212f550d669 Xiaolei Wang 2024-05-30 3224 default:
882212f550d669 Xiaolei Wang 2024-05-30 3225 netdev_dbg(priv->dev, "link speed is not known\n");

return;?

882212f550d669 Xiaolei Wang 2024-05-30 3226 }
19d9187317979c Joao Pinto 2017-03-10 3227
44781fef137896 Joao Pinto 2017-03-31 3228 /* queue 0 is reserved for legacy traffic */
44781fef137896 Joao Pinto 2017-03-31 3229 for (queue = 1; queue < tx_queues_count; queue++) {
19d9187317979c Joao Pinto 2017-03-10 3230 mode_to_use = priv->plat->tx_queues_cfg[queue].mode_to_use;
19d9187317979c Joao Pinto 2017-03-10 3231 if (mode_to_use == MTL_QUEUE_DCB)
19d9187317979c Joao Pinto 2017-03-10 3232 continue;
19d9187317979c Joao Pinto 2017-03-10 3233
882212f550d669 Xiaolei Wang 2024-05-30 @3234 value = div_s64(priv->old_idleslope[queue] * 1024ll * ptr, speed_div);
^^^ ^^^^^^^^^^
Uninitialized.

882212f550d669 Xiaolei Wang 2024-05-30 3235 priv->plat->tx_queues_cfg[queue].idle_slope = value & GENMASK(31, 0);
882212f550d669 Xiaolei Wang 2024-05-30 3236
882212f550d669 Xiaolei Wang 2024-05-30 3237 value = div_s64(-priv->old_sendslope[queue] * 1024ll * ptr, speed_div);
882212f550d669 Xiaolei Wang 2024-05-30 3238 priv->plat->tx_queues_cfg[queue].send_slope = value & GENMASK(31, 0);
882212f550d669 Xiaolei Wang 2024-05-30 3239
c10d4c82a5c84c Jose Abreu 2018-04-16 3240 stmmac_config_cbs(priv, priv->hw,
19d9187317979c Joao Pinto 2017-03-10 3241 priv->plat->tx_queues_cfg[queue].send_slope,
19d9187317979c Joao Pinto 2017-03-10 3242 priv->plat->tx_queues_cfg[queue].idle_slope,
19d9187317979c Joao Pinto 2017-03-10 3243 priv->plat->tx_queues_cfg[queue].high_credit,
19d9187317979c Joao Pinto 2017-03-10 3244 priv->plat->tx_queues_cfg[queue].low_credit,
19d9187317979c Joao Pinto 2017-03-10 3245 queue);
19d9187317979c Joao Pinto 2017-03-10 3246 }
19d9187317979c Joao Pinto 2017-03-10 3247 }

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki