public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Anand Moon <linux.amoon@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Hans Zhang <18255117159@163.com>,
	Niklas Cassel <cassel@kernel.org>,
	linux-kernel@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	netdev@vger.kernel.org, Anand Moon <linux.amoon@gmail.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Danilo Krummrich <dakr@kernel.org>
Subject: Re: [PATCH next v1] r8169: Fix PHY lookup for mdiobus_get_phy() and improve error reporting during probe
Date: Tue, 17 Mar 2026 18:45:25 +0100	[thread overview]
Message-ID: <202603171855.OtM7sS7W-lkp@intel.com> (raw)
In-Reply-To: <20260317061700.7734-1-linux.amoon@gmail.com>

Hi Anand,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 95c541ddfb0815a0ea8477af778bb13bb075079a]

url:    https://github.com/intel-lab-lkp/linux/commits/Anand-Moon/r8169-Fix-PHY-lookup-for-mdiobus_get_phy-and-improve-error-reporting-during-probe/20260317-183327
base:   95c541ddfb0815a0ea8477af778bb13bb075079a
patch link:    https://lore.kernel.org/r/20260317061700.7734-1-linux.amoon%40gmail.com
patch subject: [PATCH next v1] r8169: Fix PHY lookup for mdiobus_get_phy() and improve error reporting during probe
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260317/202603171855.OtM7sS7W-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260317/202603171855.OtM7sS7W-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/202603171855.OtM7sS7W-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/realtek/r8169_main.c:5467:17: warning: variable 'phydev' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
    5467 |         for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
         |                        ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/realtek/r8169_main.c:5476:7: note: uninitialized use occurs here
    5476 |         if (!phydev) {
         |              ^~~~~~
   drivers/net/ethernet/realtek/r8169_main.c:5467:17: note: remove the condition if it is always true
    5467 |         for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
         |                        ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/realtek/r8169_main.c:5430:27: note: initialize the variable 'phydev' to silence this warning
    5430 |         struct phy_device *phydev;
         |                                  ^
         |                                   = NULL
   1 warning generated.


vim +5467 drivers/net/ethernet/realtek/r8169_main.c

  5425	
  5426	static int r8169_mdio_register(struct rtl8169_private *tp)
  5427	{
  5428		struct pci_dev *pdev = tp->pci_dev;
  5429		struct mii_bus *new_bus;
  5430		struct phy_device *phydev;
  5431		int ret, addr;
  5432	
  5433		/* On some boards with this chip version the BIOS is buggy and misses
  5434		 * to reset the PHY page selector. This results in the PHY ID read
  5435		 * accessing registers on a different page, returning a more or
  5436		 * less random value. Fix this by resetting the page selector first.
  5437		 */
  5438		if (tp->mac_version == RTL_GIGA_MAC_VER_25 ||
  5439		    tp->mac_version == RTL_GIGA_MAC_VER_26)
  5440			r8169_mdio_write(tp, 0x1f, 0);
  5441	
  5442		new_bus = devm_mdiobus_alloc(&pdev->dev);
  5443		if (!new_bus)
  5444			return -ENOMEM;
  5445	
  5446		new_bus->name = "r8169";
  5447		new_bus->priv = tp;
  5448		new_bus->parent = &pdev->dev;
  5449		new_bus->irq[0] = PHY_MAC_INTERRUPT;
  5450		new_bus->phy_mask = GENMASK(31, 1);
  5451		snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x-%x",
  5452			 pci_domain_nr(pdev->bus), pci_dev_id(pdev));
  5453	
  5454		new_bus->read = r8169_mdio_read_reg;
  5455		new_bus->write = r8169_mdio_write_reg;
  5456	
  5457		if (tp->mac_version >= RTL_GIGA_MAC_VER_40) {
  5458			new_bus->read_c45 = r8169_mdio_read_reg_c45;
  5459			new_bus->write_c45 = r8169_mdio_write_reg_c45;
  5460		}
  5461	
  5462		ret = devm_mdiobus_register(&pdev->dev, new_bus);
  5463		if (ret)
  5464			return ret;
  5465	
  5466		/* find the first (lowest address) PHY on the current MAC's MII bus */
> 5467		for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
  5468			struct phy_device *tmp = mdiobus_get_phy(new_bus, addr);
  5469	
  5470			if (tmp) {
  5471				phydev = tmp;
  5472				break;
  5473			}
  5474		}
  5475	
  5476		if (!phydev) {
  5477			dev_err(&pdev->dev, "no PHY found on bus\n");
  5478			return -ENODEV;
  5479		}
  5480	
  5481		/* Most chip versions fail with the genphy driver.
  5482		 * Therefore ensure that the dedicated PHY driver is loaded.
  5483		 */
  5484		if (!phydev->drv) {
  5485			dev_err(&pdev->dev, "no dedicated PHY driver found for PHY ID 0x%08x, maybe realtek.ko needs to be added to initramfs?\n",
  5486				phydev->phy_id);
  5487			return -EUNATCH;
  5488		}
  5489	
  5490		tp->phydev = phydev;
  5491		tp->phydev->mac_managed_pm = true;
  5492		if (rtl_supports_eee(tp))
  5493			phy_support_eee(tp->phydev);
  5494		phy_support_asym_pause(tp->phydev);
  5495	
  5496		/* mimic behavior of r8125/r8126 vendor drivers */
  5497		if (tp->mac_version == RTL_GIGA_MAC_VER_61)
  5498			phy_disable_eee_mode(tp->phydev,
  5499					     ETHTOOL_LINK_MODE_2500baseT_Full_BIT);
  5500	
  5501		/* PHY will be woken up in rtl_open() */
  5502		phy_suspend(tp->phydev);
  5503	
  5504		return 0;
  5505	}
  5506	

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

  parent reply	other threads:[~2026-03-17 17:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17  6:16 [PATCH next v1] r8169: Fix PHY lookup for mdiobus_get_phy() and improve error reporting during probe Anand Moon
2026-03-17  6:51 ` Heiner Kallweit
2026-03-17  7:59   ` Anand Moon
2026-03-17  9:44     ` Heiner Kallweit
2026-03-17 14:11       ` Anand Moon
2026-03-17 17:45 ` kernel test robot [this message]
2026-03-19 23:53 ` kernel test robot
2026-03-20  3:06   ` Anand Moon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202603171855.OtM7sS7W-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=18255117159@163.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=cassel@kernel.org \
    --cc=dakr@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux.amoon@gmail.com \
    --cc=llvm@lists.linux.dev \
    --cc=mani@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pabeni@redhat.com \
    --cc=robin.murphy@arm.com \
    --cc=shawn.lin@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox