Re: [PATCH next v1] r8169: Fix PHY lookup for mdiobus_get_phy() and improve error reporting during probe

From: Anand Moon

Date: Tue Mar 17 2026 - 10:21:48 EST


Hi Heiner,

On Tue, 17 Mar 2026 at 15:14, Heiner Kallweit <hkallweit1@xxxxxxxxx> wrote:
>
> On 17.03.2026 08:59, Anand Moon wrote:
> > Hi Heiner,
> >
> > Thanks for your review comments.
> >
> > On Tue, 17 Mar 2026 at 12:21, Heiner Kallweit <hkallweit1@xxxxxxxxx> wrote:
> >>
> >> On 17.03.2026 07:16, Anand Moon wrote:
> >>> The driver currently assumes the PHY is always at address 0. On some
> >>> hardware or buggy BIOS implementations, the PHY may reside at a
> >>> different address on the MDIO bus. Update r8169_mdio_register()
> >>> to scan the bus for the first available PHY instead of hardcoding
> >>> address 0.
> >>
> >> No. The PHY always shows up at (virtual) address 0, due to the
> >> MAC register based way of accessing the internal PHY.
> >> Do you have any concrete example of such a "hardware or buggy bios"?
> >>
> > Sorry about that, I didn't realize. Unfortunately, my testing shows
> > this still doesn't
> > fix the problem, but I still perceive. I modeled the change after some
> > other drivers,
> > but clearly, that approach isn't working in this case.
> >>>
> >>
> >> This check is needed. It's seems your actual intention is something completely
> >> different from what you state in the commit message. You try to find a workaround
> >> for the issues with request_module() from async contect, caused by the referenced
> >> change to Rockchip PCI.
> > That makes sense, sorry for the noise.
> >
> > What are your thoughts on using dev_err_probe() for these registration failures?
> > I thought it might clean up the error path.
> >
> I'm not aware of any realistic scenario where these calls would fail (w/o printing
> an error message before). So adding an error message wouldn't hurt, but it also
> wouldn't be beneficial enough to justify a patch.
>
If we enable .probe_type = PROBE_PREFER_ASYNCHRONOUS in pcie-dw-rockchip.c,
The r8169 module probe will fail due to the module’s request for
synchronous probing.

[1] https://lore.kernel.org/all/87bc37ee-234c-4568-b72e-955c130a6838@xxxxxxx/

Some were in the module, but the probe failed to load the module or firmware.
I hope these changes will resolve the probe warning.

----->8-----
diff --git a/drivers/net/ethernet/realtek/r8169_main.c
b/drivers/net/ethernet/realtek/r8169_main.c
index 791277e750ba..8b7858f6dc6d 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -5790,11 +5790,11 @@ static int rtl_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)

rc = r8169_mdio_register(tp);
if (rc)
- return rc;
+ return dev_err_probe(&pdev->dev, rc, "mdio register failure\n");

rc = register_netdev(dev);
if (rc)
- return rc;
+ return dev_err_probe(&pdev->dev, rc, "register newdev
failure\n");

if (IS_ENABLED(CONFIG_R8169_LEDS)) {
if (rtl_is_8125(tp))

Thanks
-Anand