[PATCH net-next] net: mscc: ocelot: Fix probe for vsc7514

From: Horatiu Vultur
Date: Tue Aug 17 2021 - 08:06:19 EST


The check for parsing the 'phy-handle' was removed in the blamed commit.
Therefor it would try to create phylinks for each port and connect to
the phys. But on ocelot_pcb123 and ocelot_pcb120 not all the ports have
a phy, so this will failed. So the probe of the network driver will
fail.

The fix consists in adding back the check for 'phy-handle' for vsc7514

Fixes: e6e12df625f2 ("net: mscc: ocelot: convert to phylink")
Signed-off-by: Horatiu Vultur <horatiu.vultur@xxxxxxxxxxxxx>
---
drivers/net/ethernet/mscc/ocelot_vsc7514.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c
index 18aed504f45d..96ac64f13382 100644
--- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c
+++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c
@@ -954,6 +954,9 @@ static int mscc_ocelot_init_ports(struct platform_device *pdev,
if (of_property_read_u32(portnp, "reg", &reg))
continue;

+ if (!of_parse_phandle(portnp, "phy-handle", 0))
+ continue;
+
port = reg;
if (port < 0 || port >= ocelot->num_phys_ports) {
dev_err(ocelot->dev,
--
2.31.1