Subject: Re: [PATCH v2 4/4] net: phy: realtek: add RTL8224 polarity support

From: kernel test robot <[email-masked]>
Date: Fri, 23 Jan 2026 02:41:50 +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-4-dam.dejean%40gmail.com
patch subject: [PATCH v2 4/4] net: phy: realtek: add RTL8224 polarity 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:1744 rtl8224_mdi_config_polarity() warn: unsigned 'val' is never less than zero.

Old smatch warnings:
drivers/net/phy/realtek/realtek_main.c:806 rtl821x_resume() warn: 'priv->clk' from clk_prepare_enable() not released on lines: 802.
drivers/net/phy/realtek/realtek_main.c:1711 rtl8224_mdi_config_order() warn: unsigned 'val' is never less than zero.

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

  1722	
  1723	static int rtl8224_mdi_config_polarity(struct phy_device *phydev)
  1724	{
  1725		struct device_node *np = phydev->mdio.dev.of_node;
  1726		u8 port_offset = phydev->mdio.addr & 3;
  1727		u32 polarity, val;
  1728		int ret;
  1729	
  1730		ret = of_property_read_u32(np, "realtek,mdi-cfg-polarity", &polarity);
  1731	
  1732		/* Do nothing if the property is not present */
  1733		if (ret == -EINVAL)
  1734			return 0;
  1735	
  1736		if (!ret)
  1737			return ret;
  1738	
  1739		if (polarity & ~0xf)
  1740			return -EINVAL;
  1741	
  1742		val = __phy_package_read_mmd(phydev, 0, MDIO_MMD_VEND1,
  1743					     RTL8224_VND1_MDI_POLARITY_SWAP);
> 1744		if (val < 0)
  1745			return val;
  1746	
  1747		val &= ~(0xf << port_offset);
  1748		val |= polarity << port_offset;
  1749		return __phy_package_write_mmd(phydev, 0, MDIO_MMD_VEND1,
  1750					       RTL8224_VND1_MDI_POLARITY_SWAP, val);
  1751	}
  1752	

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