aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366_smi.c6
1 files changed, 5 insertions, 1 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 0873224225..c21ad9425d 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
@@ -916,9 +916,10 @@ static inline void rtl8366_debugfs_remove(struct rtl8366_smi *smi) {}
static int rtl8366_smi_mii_init(struct rtl8366_smi *smi)
{
int ret;
- struct device_node *np = NULL;
#ifdef CONFIG_OF
+ struct device_node *np = NULL;
+
np = of_get_child_by_name(smi->parent->of_node, "mdio-bus");
#endif
@@ -945,10 +946,13 @@ static int rtl8366_smi_mii_init(struct rtl8366_smi *smi)
}
#endif
+#ifdef CONFIG_OF
if (np)
ret = of_mdiobus_register(smi->mii_bus, np);
else
+#endif
ret = mdiobus_register(smi->mii_bus);
+
if (ret)
goto err_free;