realtek: dsa: handle error returned by PCS

Check for and handle an error which may be returned by rtpcs_create in
various cases.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/20577
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Jonas Jelonek 2025-10-27 18:46:08 +00:00 committed by Robert Marko
parent 87c76704d2
commit c447ba0a83

View File

@ -335,8 +335,6 @@ static int __init rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv)
continue;
pcs_node = of_parse_phandle(dn, "pcs-handle", 0);
priv->pcs[pn] = rtpcs_create(priv->dev, pcs_node, pn);
phy_node = of_parse_phandle(dn, "phy-handle", 0);
if (!phy_node) {
if (pn != priv->cpu_port)
@ -344,6 +342,14 @@ static int __init rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv)
continue;
}
priv->pcs[pn] = rtpcs_create(priv->dev, pcs_node, pn);
if (IS_ERR(priv->pcs[pn])) {
dev_err(priv->dev, "port %u failed to create PCS instance: %ld\n",
pn, PTR_ERR(priv->pcs[pn]));
priv->pcs[pn] = NULL;
continue;
}
/*
* TODO: phylink_pcs was completely converted to the standalone PCS driver - see
* rtpcs_create(). Nevertheless the DSA driver still relies on the info about the