From: Jonas Jelonek Date: Mon, 27 Oct 2025 18:46:08 +0000 (+0000) Subject: realtek: dsa: handle error returned by PCS X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=c447ba0a8387a0e55954387083a3c011749a96f0;p=openwrt%2Fstaging%2Fblocktrron.git 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 Link: https://github.com/openwrt/openwrt/pull/20577 Signed-off-by: Robert Marko --- diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c index a073a1a5d2..190e495287 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c @@ -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