oe-kbuild.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH net-next 2/2] net: phy: air_en8811h: Add the Airoha EN8811H PHY driver
@ 2024-02-11  0:30 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2024-02-11  0:30 UTC (permalink / raw
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20240206194751.1901802-3-ericwouds@gmail.com>
References: <20240206194751.1901802-3-ericwouds@gmail.com>
TO: Eric Woudstra <ericwouds@gmail.com>

Hi Eric,

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/Eric-Woudstra/dt-bindings-net-airoha-en8811h-Add-en8811h-serdes-polarity/20240207-035021
base:   net-next/main
patch link:    https://lore.kernel.org/r/20240206194751.1901802-3-ericwouds%40gmail.com
patch subject: [PATCH net-next 2/2] net: phy: air_en8811h: Add the Airoha EN8811H PHY driver
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: sh-randconfig-r081-20240211 (https://download.01.org/0day-ci/archive/20240211/202402110805.r1KRiKtL-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 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 <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202402110805.r1KRiKtL-lkp@intel.com/

smatch warnings:
drivers/net/phy/air_en8811h.c:560 air_led_hw_control_set() error: testing array offset 'index' after use.

vim +/index +560 drivers/net/phy/air_en8811h.c

3fe47bc0b949e7 Eric Woudstra 2024-02-06  550  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  551  static int air_led_hw_control_set(struct phy_device *phydev, u8 index,
3fe47bc0b949e7 Eric Woudstra 2024-02-06  552  				  unsigned long rules)
3fe47bc0b949e7 Eric Woudstra 2024-02-06  553  {
3fe47bc0b949e7 Eric Woudstra 2024-02-06  554  	struct en8811h_priv *priv = phydev->priv;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  555  	u16 on = 0, blink = 0;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  556  	int ret;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  557  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  558  	priv->led[index].rules = rules;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  559  
3fe47bc0b949e7 Eric Woudstra 2024-02-06 @560  	if (index >= EN8811H_LED_COUNT)
3fe47bc0b949e7 Eric Woudstra 2024-02-06  561  		return -EINVAL;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  562  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  563  	if (rules & (BIT(TRIGGER_NETDEV_LINK_10)   | BIT(TRIGGER_NETDEV_LINK))) {
3fe47bc0b949e7 Eric Woudstra 2024-02-06  564  		on |= AIR_PHY_LED_ON_LINK10;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  565  		if (rules & BIT(TRIGGER_NETDEV_RX))
3fe47bc0b949e7 Eric Woudstra 2024-02-06  566  			blink |= AIR_PHY_LED_BLINK_10RX;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  567  		if (rules & BIT(TRIGGER_NETDEV_TX))
3fe47bc0b949e7 Eric Woudstra 2024-02-06  568  			blink |= AIR_PHY_LED_BLINK_10TX;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  569  	}
3fe47bc0b949e7 Eric Woudstra 2024-02-06  570  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  571  	if (rules & (BIT(TRIGGER_NETDEV_LINK_100)  | BIT(TRIGGER_NETDEV_LINK))) {
3fe47bc0b949e7 Eric Woudstra 2024-02-06  572  		on |= AIR_PHY_LED_ON_LINK100;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  573  		if (rules & BIT(TRIGGER_NETDEV_RX))
3fe47bc0b949e7 Eric Woudstra 2024-02-06  574  			blink |= AIR_PHY_LED_BLINK_100RX;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  575  		if (rules & BIT(TRIGGER_NETDEV_TX))
3fe47bc0b949e7 Eric Woudstra 2024-02-06  576  			blink |= AIR_PHY_LED_BLINK_100TX;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  577  	}
3fe47bc0b949e7 Eric Woudstra 2024-02-06  578  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  579  	if (rules & (BIT(TRIGGER_NETDEV_LINK_1000) | BIT(TRIGGER_NETDEV_LINK))) {
3fe47bc0b949e7 Eric Woudstra 2024-02-06  580  		on |= AIR_PHY_LED_ON_LINK1000;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  581  		if (rules & BIT(TRIGGER_NETDEV_RX))
3fe47bc0b949e7 Eric Woudstra 2024-02-06  582  			blink |= AIR_PHY_LED_BLINK_1000RX;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  583  		if (rules & BIT(TRIGGER_NETDEV_TX))
3fe47bc0b949e7 Eric Woudstra 2024-02-06  584  			blink |= AIR_PHY_LED_BLINK_1000TX;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  585  	}
3fe47bc0b949e7 Eric Woudstra 2024-02-06  586  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  587  	if (rules & (BIT(TRIGGER_NETDEV_LINK_2500) | BIT(TRIGGER_NETDEV_LINK))) {
3fe47bc0b949e7 Eric Woudstra 2024-02-06  588  		on |= AIR_PHY_LED_ON_LINK2500;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  589  		if (rules & BIT(TRIGGER_NETDEV_RX))
3fe47bc0b949e7 Eric Woudstra 2024-02-06  590  			blink |= AIR_PHY_LED_BLINK_2500RX;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  591  		if (rules & BIT(TRIGGER_NETDEV_TX))
3fe47bc0b949e7 Eric Woudstra 2024-02-06  592  			blink |= AIR_PHY_LED_BLINK_2500TX;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  593  	}
3fe47bc0b949e7 Eric Woudstra 2024-02-06  594  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  595  	if (on == 0) {
3fe47bc0b949e7 Eric Woudstra 2024-02-06  596  		if (rules & BIT(TRIGGER_NETDEV_RX)) {
3fe47bc0b949e7 Eric Woudstra 2024-02-06  597  			blink |= AIR_PHY_LED_BLINK_10RX   |
3fe47bc0b949e7 Eric Woudstra 2024-02-06  598  				 AIR_PHY_LED_BLINK_100RX  |
3fe47bc0b949e7 Eric Woudstra 2024-02-06  599  				 AIR_PHY_LED_BLINK_1000RX |
3fe47bc0b949e7 Eric Woudstra 2024-02-06  600  				 AIR_PHY_LED_BLINK_2500RX;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  601  		}
3fe47bc0b949e7 Eric Woudstra 2024-02-06  602  		if (rules & BIT(TRIGGER_NETDEV_TX)) {
3fe47bc0b949e7 Eric Woudstra 2024-02-06  603  			blink |= AIR_PHY_LED_BLINK_10TX   |
3fe47bc0b949e7 Eric Woudstra 2024-02-06  604  				 AIR_PHY_LED_BLINK_100TX  |
3fe47bc0b949e7 Eric Woudstra 2024-02-06  605  				 AIR_PHY_LED_BLINK_1000TX |
3fe47bc0b949e7 Eric Woudstra 2024-02-06  606  				 AIR_PHY_LED_BLINK_2500TX;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  607  		}
3fe47bc0b949e7 Eric Woudstra 2024-02-06  608  	}
3fe47bc0b949e7 Eric Woudstra 2024-02-06  609  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  610  	if (rules & BIT(TRIGGER_NETDEV_FULL_DUPLEX))
3fe47bc0b949e7 Eric Woudstra 2024-02-06  611  		on |= AIR_PHY_LED_ON_FDX;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  612  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  613  	if (rules & BIT(TRIGGER_NETDEV_HALF_DUPLEX))
3fe47bc0b949e7 Eric Woudstra 2024-02-06  614  		on |= AIR_PHY_LED_ON_HDX;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  615  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  616  	if (blink || on) {
3fe47bc0b949e7 Eric Woudstra 2024-02-06  617  		/* switch hw-control on, so led-on and led-blink are off */
3fe47bc0b949e7 Eric Woudstra 2024-02-06  618  		clear_bit(AIR_PHY_LED_STATE_FORCE_ON, &priv->led[index].state);
3fe47bc0b949e7 Eric Woudstra 2024-02-06  619  		clear_bit(AIR_PHY_LED_STATE_FORCE_BLINK, &priv->led[index].state);
3fe47bc0b949e7 Eric Woudstra 2024-02-06  620  	} else {
3fe47bc0b949e7 Eric Woudstra 2024-02-06  621  		priv->led[index].rules = 0;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  622  	}
3fe47bc0b949e7 Eric Woudstra 2024-02-06  623  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  624  	ret = phy_modify_mmd(phydev, MDIO_MMD_VEND2, AIR_PHY_LED_ON(index),
3fe47bc0b949e7 Eric Woudstra 2024-02-06  625  			     AIR_PHY_LED_ON_MASK, on);
3fe47bc0b949e7 Eric Woudstra 2024-02-06  626  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  627  	if (ret < 0)
3fe47bc0b949e7 Eric Woudstra 2024-02-06  628  		return ret;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  629  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  630  	return phy_write_mmd(phydev, MDIO_MMD_VEND2, AIR_PHY_LED_BLINK(index),
3fe47bc0b949e7 Eric Woudstra 2024-02-06  631  			     blink);
3fe47bc0b949e7 Eric Woudstra 2024-02-06  632  };
3fe47bc0b949e7 Eric Woudstra 2024-02-06  633  

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next 2/2] net: phy: air_en8811h: Add the Airoha EN8811H PHY driver
       [not found] <20240206194751.1901802-3-ericwouds@gmail.com>
@ 2024-02-12  8:17 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2024-02-12  8:17 UTC (permalink / raw
  To: oe-kbuild, Eric Woudstra; +Cc: lkp, oe-kbuild-all

Hi Eric,

kernel test robot noticed the following build warnings:

url:    https://github.com/intel-lab-lkp/linux/commits/Eric-Woudstra/dt-bindings-net-airoha-en8811h-Add-en8811h-serdes-polarity/20240207-035021
base:   net-next/main
patch link:    https://lore.kernel.org/r/20240206194751.1901802-3-ericwouds%40gmail.com
patch subject: [PATCH net-next 2/2] net: phy: air_en8811h: Add the Airoha EN8811H PHY driver
config: sh-randconfig-r081-20240211 (https://download.01.org/0day-ci/archive/20240211/202402110805.r1KRiKtL-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 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 <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202402110805.r1KRiKtL-lkp@intel.com/

smatch warnings:
drivers/net/phy/air_en8811h.c:560 air_led_hw_control_set() error: testing array offset 'index' after use.

vim +/index +560 drivers/net/phy/air_en8811h.c

3fe47bc0b949e7 Eric Woudstra 2024-02-06  551  static int air_led_hw_control_set(struct phy_device *phydev, u8 index,
3fe47bc0b949e7 Eric Woudstra 2024-02-06  552  				  unsigned long rules)
3fe47bc0b949e7 Eric Woudstra 2024-02-06  553  {
3fe47bc0b949e7 Eric Woudstra 2024-02-06  554  	struct en8811h_priv *priv = phydev->priv;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  555  	u16 on = 0, blink = 0;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  556  	int ret;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  557  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  558  	priv->led[index].rules = rules;
                                                         ^^^^^^
out of bounds

3fe47bc0b949e7 Eric Woudstra 2024-02-06  559  
3fe47bc0b949e7 Eric Woudstra 2024-02-06 @560  	if (index >= EN8811H_LED_COUNT)
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^

Too late.  priv->led[] has EN8811H_LED_COUNT elements.

3fe47bc0b949e7 Eric Woudstra 2024-02-06  561  		return -EINVAL;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  562  
3fe47bc0b949e7 Eric Woudstra 2024-02-06  563  	if (rules & (BIT(TRIGGER_NETDEV_LINK_10)   | BIT(TRIGGER_NETDEV_LINK))) {
3fe47bc0b949e7 Eric Woudstra 2024-02-06  564  		on |= AIR_PHY_LED_ON_LINK10;
3fe47bc0b949e7 Eric Woudstra 2024-02-06  565  		if (rules & BIT(TRIGGER_NETDEV_RX))
3fe47bc0b949e7 Eric Woudstra 2024-02-06  566  			blink |= AIR_PHY_LED_BLINK_10RX;

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-12  8:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-11  0:30 [PATCH net-next 2/2] net: phy: air_en8811h: Add the Airoha EN8811H PHY driver kernel test robot
     [not found] <20240206194751.1901802-3-ericwouds@gmail.com>
2024-02-12  8:17 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).