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

kernel test robot
2025-03-29T18:53:22Z

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: riscv-randconfig-r072-20250329 (https://download.01.org/0day-ci/archive/20250330/202503300205.g0FCozVG-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)

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/202503300205.g0FCozVG-lkp@intel.com/

smatch warnings:
drivers/net/phy/as21xxx.c:744 as21xxx_led_hw_control_get() warn: unsigned 'val' is never less than zero.
drivers/net/phy/as21xxx.c:775 as21xxx_led_hw_control_set() error: uninitialized symbol 'val'.
drivers/net/phy/as21xxx.c:802 as21xxx_led_polarity_set() error: uninitialized symbol 'led_active_low'.

vim +/val +744 drivers/net/phy/as21xxx.c

733
734 static int as21xxx_led_hw_control_get(struct phy_device *phydev, u8 index,
735 unsigned long *rules)
736 {
737 u16 val;
738 int i;
739
740 if (index > AEON_MAX_LDES)
741 return -EINVAL;
742
743 val = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_LED_REG(index));
> 744 if (val < 0)
745 return val;
746
747 val &= VEND1_LED_REG_A_EVENT;
748 for (i = 0; i < ARRAY_SIZE(as21xxx_led_supported_pattern); i++)
749 if (val == as21xxx_led_supported_pattern[i].val) {
750 *rules = as21xxx_led_supported_pattern[i].pattern;
751 return 0;
752 }
753
754 /* Should be impossible */
755 return -EINVAL;
756 }
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
778 static int as21xxx_led_polarity_set(struct phy_device *phydev, int index,
779 unsigned long modes)
780 {
781 bool led_active_low;
782 u16 mask, val = 0;
783 u32 mode;
784
785 if (index > AEON_MAX_LDES)
786 return -EINVAL;
787
788 for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) {
789 switch (mode) {
790 case PHY_LED_ACTIVE_LOW:
791 led_active_low = true;
792 break;
793 case PHY_LED_ACTIVE_HIGH: /* default mode */
794 led_active_low = false;
795 break;
796 default:
797 return -EINVAL;
798 }
799 }
800
801 mask = VEND1_GLB_CPU_CTRL_LED_POLARITY(index);
> 802 if (led_active_low)
803 val = VEND1_GLB_CPU_CTRL_LED_POLARITY(index);
804
805 return phy_modify_mmd(phydev, MDIO_MMD_VEND1,
806 VEND1_GLB_REG_CPU_CTRL,
807 mask, val);
808 }
809

--
0-DAY CI Kernel Test Service