Re: [net-next PATCH 1/2] net: phy: Add support for new Aeonsemi PHYs

kernel test robot
2025-03-24T03:20:14Z

Hi Christian,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url: https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/dt-bindings-net-Document-support-for-Aeonsemi-PHYs/20250324-065920
base: net-next/main
patch link: https://lore.kernel.org/r/20250323225439.32400-1-ansuelsmth%40gmail.com
patch subject: [net-next PATCH 1/2] net: phy: Add support for new Aeonsemi PHYs
config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20250324/202503241125.KKDZ7C9F-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project c2692afc0a92cd5da140dfcdfff7818a5b8ce997)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250324/202503241125.KKDZ7C9F-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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503241125.KKDZ7C9F-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/phy/as21xxx.c:767:14: warning: variable 'val' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
767 | for (i = 0; i < ARRAY_SIZE(as21xxx_led_supported_pattern); i++)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/phy/as21xxx.c:775:33: note: uninitialized use occurs here
775 | VEND1_LED_REG_A_EVENT, val);
| ^~~
drivers/net/phy/as21xxx.c:767:14: note: remove the condition if it is always true
767 | for (i = 0; i < ARRAY_SIZE(as21xxx_led_supported_pattern); i++)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/phy/as21xxx.c:761:9: note: initialize the variable 'val' to silence this warning
761 | u16 val;
| ^
| = 0
1 warning generated.

vim +767 drivers/net/phy/as21xxx.c

757
758 static int as21xxx_led_hw_control_set(struct phy_device *phydev, u8 index,
759 unsigned long rules)
760 {
761 u16 val;
762 int i;
763
764 if (index > AEON_MAX_LDES)
765 return -EINVAL;
766
> 767 for (i = 0; i < ARRAY_SIZE(as21xxx_led_supported_pattern); i++)
768 if (rules == as21xxx_led_supported_pattern[i].pattern) {
769 val = as21xxx_led_supported_pattern[i].val;
770 break;
771 }
772
773 return phy_modify_mmd(phydev, MDIO_MMD_VEND1,
774 VEND1_LED_REG(index),
775 VEND1_LED_REG_A_EVENT, val);
776 }
777

--
0-DAY CI Kernel Test Service