[Linux-stm32] [PATCH net] net: stmmac: propagate PTP addend and system time programming errors

Lorenzo Bianconi lorenzo.bianconi at oss.qualcomm.com
Thu Sep 24 12:32:05 UTC 2026


> Hi Lorenzo,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on 1e24c4f2ee44be0eee94092b5d13cbdb4bdf0d60]
>
> url:
> https://github.com/intel-lab-lkp/linux/commits/Lorenzo-Bianconi/net-stmmac-propagate-PTP-addend-and-system-time-programming-errors/20260920-150002
> base:   1e24c4f2ee44be0eee94092b5d13cbdb4bdf0d60
> patch link:
> https://lore.kernel.org/r/20260920-stmmac-ptp-added-systime-error-v1-1-8ac9e7a3fce2%40oss.qualcomm.com
> patch subject: [PATCH net] net: stmmac: propagate PTP addend and system
> time programming errors
> config: arm-defconfig (
> https://download.01.org/0day-ci/archive/20260924/202609240727.6U1AzUEr-lkp@intel.com/config
> )
> compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project
> 6e714c8d91116794cb699cdf80c26afe9cda3ef3)
> reproduce (this is a W=1 build): (
> https://download.01.org/0day-ci/archive/20260924/202609240727.6U1AzUEr-lkp@intel.com/reproduce
> )
>
> 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 <lkp at intel.com>
> | Closes:
> https://lore.kernel.org/oe-kbuild-all/202609240727.6U1AzUEr-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
>
ack, I will fix the issue in v2.

Regards,
Lorenzo


> >> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:613:2: warning:
> variable 'sec_inc' is used uninitialized whenever 'if' condition is false
> [-Wsometimes-uninitialized]
>      613 |         stmmac_config_sub_second_increment(priv, priv->ptpaddr,
>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      614 |
> priv->plat->clk_ptp_rate,
>          |
> ~~~~~~~~~~~~~~~~~~~~~~~~~
>      615 |                                            xmac, &sec_inc);
>          |                                            ~~~~~~~~~~~~~~~
>    drivers/net/ethernet/stmicro/stmmac/hwif.h:517:2: note: expanded from
> macro 'stmmac_config_sub_second_increment'
>      517 |         stmmac_do_void_callback(__priv, ptp,
> config_sub_second_increment, __args)
>          |
>  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    drivers/net/ethernet/stmicro/stmmac/hwif.h:15:6: note: expanded from
> macro 'stmmac_do_void_callback'
>       15 |         if ((__priv)->hw->__module &&
> (__priv)->hw->__module->__cname) { \
>          |
>  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:617:25: note:
> uninitialized use occurs here
>      617 |         priv->sub_second_inc = sec_inc;
>          |                                ^~~~~~~
>    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:613:2: note: remove
> the 'if' if its condition is always true
>      613 |         stmmac_config_sub_second_increment(priv, priv->ptpaddr,
>          |         ^
>    drivers/net/ethernet/stmicro/stmmac/hwif.h:517:2: note: expanded from
> macro 'stmmac_config_sub_second_increment'
>      517 |         stmmac_do_void_callback(__priv, ptp,
> config_sub_second_increment, __args)
>          |         ^
>    drivers/net/ethernet/stmicro/stmmac/hwif.h:15:2: note: expanded from
> macro 'stmmac_do_void_callback'
>       15 |         if ((__priv)->hw->__module &&
> (__priv)->hw->__module->__cname) { \
>          |         ^
> >> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:613:2: warning:
> variable 'sec_inc' is used uninitialized whenever '&&' condition is false
> [-Wsometimes-uninitialized]
>      613 |         stmmac_config_sub_second_increment(priv, priv->ptpaddr,
>          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      614 |
> priv->plat->clk_ptp_rate,
>          |
> ~~~~~~~~~~~~~~~~~~~~~~~~~
>      615 |                                            xmac, &sec_inc);
>          |                                            ~~~~~~~~~~~~~~~
>    drivers/net/ethernet/stmicro/stmmac/hwif.h:517:2: note: expanded from
> macro 'stmmac_config_sub_second_increment'
>      517 |         stmmac_do_void_callback(__priv, ptp,
> config_sub_second_increment, __args)
>          |
>  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    drivers/net/ethernet/stmicro/stmmac/hwif.h:15:6: note: expanded from
> macro 'stmmac_do_void_callback'
>       15 |         if ((__priv)->hw->__module &&
> (__priv)->hw->__module->__cname) { \
>          |             ^~~~~~~~~~~~~~~~~~~~~~
>    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:617:25: note:
> uninitialized use occurs here
>      617 |         priv->sub_second_inc = sec_inc;
>          |                                ^~~~~~~
>    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:613:2: note: remove
> the '&&' if its condition is always true
>      613 |         stmmac_config_sub_second_increment(priv, priv->ptpaddr,
>          |         ^
>    drivers/net/ethernet/stmicro/stmmac/hwif.h:517:2: note: expanded from
> macro 'stmmac_config_sub_second_increment'
>      517 |         stmmac_do_void_callback(__priv, ptp,
> config_sub_second_increment, __args)
>          |         ^
>    drivers/net/ethernet/stmicro/stmmac/hwif.h:15:6: note: expanded from
> macro 'stmmac_do_void_callback'
>       15 |         if ((__priv)->hw->__module &&
> (__priv)->hw->__module->__cname) { \
>          |             ^
>    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:609:13: note:
> initialize the variable 'sec_inc' to silence this warning
>      609 |         u32 sec_inc;
>          |                    ^
>          |                     = 0
>    2 warnings generated.
>
>
> vim +613 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>
>    603
>    604  static void stmmac_restore_subsecond_increment(struct stmmac_priv
> *priv,
>    605                                                 u32 default_addend,
>    606                                                 u32 systime_flags)
>    607  {
>    608          bool xmac = dwmac_is_xmac(priv->plat->core_type);
>    609          u32 sec_inc;
>    610
>    611          stmmac_config_addend(priv, priv->ptpaddr, default_addend);
>    612          stmmac_config_hw_tstamping(priv, priv->ptpaddr,
> systime_flags);
>  > 613          stmmac_config_sub_second_increment(priv, priv->ptpaddr,
>    614
>  priv->plat->clk_ptp_rate,
>    615                                             xmac, &sec_inc);
>    616          priv->default_addend = default_addend;
>    617          priv->sub_second_inc = sec_inc;
>    618  }
>    619
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://st-md-mailman.stormreply.com/pipermail/linux-stm32/attachments/20260924/9d9a98dd/attachment.html>


More information about the Linux-stm32 mailing list