Subject: Re: [PATCH v2 2/4] net: phy: realtek: add RTL8224 pair order support

From: kernel test robot <[email-masked]>
Date: Fri, 23 Jan 2026 01:39:19 +0800

Hi Damien,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 983d014aafb14ee5e4915465bf8948e8f3a723b5]

url:    https://github.com/intel-lab-lkp/linux/commits/Damien-Dejean/net-phy-realtek-add-RTL8224-pair-order-support/20260122-000009
base:   983d014aafb14ee5e4915465bf8948e8f3a723b5
patch link:    https://lore.kernel.org/r/20260121151506.813783-2-dam.dejean%40gmail.com
patch subject: [PATCH v2 2/4] net: phy: realtek: add RTL8224 pair order support
config: i386-randconfig-141-20260122 (https://download.01.org/0day-ci/archive/20260123/[email-masked]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch version: v0.5.0-8994-gd50c5a4c

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-masked]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email-masked]/

New smatch warnings:
drivers/net/phy/realtek/realtek_main.c:1710 rtl8224_mdi_config_order() warn: unsigned 'val' is never less than zero.

Old smatch warnings:
drivers/net/phy/realtek/realtek_main.c:805 rtl821x_resume() warn: 'priv->clk' from clk_prepare_enable() not released on lines: 801.

vim +/val +1710 drivers/net/phy/realtek/realtek_main.c

  1688	
  1689	static int rtl8224_mdi_config_order(struct phy_device *phydev)
  1690	{
  1691		struct device_node *np = phydev->mdio.dev.of_node;
  1692		u8 port_offset = phydev->mdio.addr & 3;
  1693		u32 mdi_conf, val;
  1694		int ret;
  1695	
  1696		ret = of_property_read_u32(np, "realtek,mdi-cfg-order", &mdi_conf);
  1697	
  1698		/* Do nothing in case the property is not present */
  1699		if (ret == -EINVAL)
  1700			return 0;
  1701	
  1702		if (ret)
  1703			return ret;
  1704	
  1705		if (mdi_conf & ~1)
  1706			return -EINVAL;
  1707	
  1708		val = __phy_package_read_mmd(phydev, 0, MDIO_MMD_VEND1,
  1709					     RTL8224_VND1_MDI_PAIR_SWAP);
> 1710		if (val < 0)
  1711			return val;
  1712	
  1713		if (mdi_conf)
  1714			val |= (1 << port_offset);
  1715		else
  1716			val &= ~(1 << port_offset);
  1717	
  1718		return __phy_package_write_mmd(phydev, 0, MDIO_MMD_VEND1,
  1719					       RTL8224_VND1_MDI_PAIR_SWAP, val);
  1720	}
  1721	

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