[openwrt/openwrt] kernel: rtl836x: directly defer probe when mdio is missing

LEDE Commits lede-commits at lists.infradead.org
Tue Dec 23 09:24:21 PST 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/52924bf19444bbb6c047725399b993c9a1092558

commit 52924bf19444bbb6c047725399b993c9a1092558
Author: Shiji Yang <yangshiji66 at outlook.com>
AuthorDate: Mon Dec 15 19:37:03 2025 +0800

    kernel: rtl836x: directly defer probe when mdio is missing
    
    If the switch is directly controlled by the mdio bus, we must ensure
    that the mdio bus is ready instead of trying GPIO simulated bus.
    
    Fixes: d4ac26ec4920 ("kernel: rtl8366-smi: add Realtek switch management via mii-bus")
    Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
    Link: https://github.com/openwrt/openwrt/pull/21143
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 target/linux/generic/files/drivers/net/phy/rtl8366_smi.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
index 905283b0c2..f043b2b875 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
@@ -1497,7 +1497,7 @@ static int rtl8366_smi_probe_of(struct platform_device *pdev, struct rtl8366_smi
 	if (!smi->ext_mbus) {
 		dev_info(&pdev->dev,
 			"cannot find mdio bus from bus handle (yet)");
-		goto try_gpio;
+		return -EPROBE_DEFER;
 	}
 
 	if (of_property_read_u32(np, "phy-id", &smi->phy_id))
@@ -1507,12 +1507,8 @@ static int rtl8366_smi_probe_of(struct platform_device *pdev, struct rtl8366_smi
 
 try_gpio:
 	if (!gpio_is_valid(sck) || !gpio_is_valid(sda)) {
-		if (!mdio_node) {
-			dev_err(&pdev->dev, "gpios missing in devictree\n");
-			return -EINVAL;
-		} else {
-			return -EPROBE_DEFER;
-		}
+		dev_err(&pdev->dev, "gpios missing in devictree\n");
+		return -EINVAL;
 	}
 
 	smi->gpio_sda = sda;




More information about the lede-commits mailing list