summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Jelonek2025-10-27 18:46:08 +0000
committerRobert Marko2025-11-02 15:32:09 +0000
commitc447ba0a8387a0e55954387083a3c011749a96f0 (patch)
tree3ddfb7d5eba5c07484d9207ce71a3279cbfbfedc
parent87c76704d263048d6c146ed0137d79f9ce008074 (diff)
downloadopenwrt-c447ba0a8387a0e55954387083a3c011749a96f0.tar.gz
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>
-rw-r--r--target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c10
1 files changed, 8 insertions, 2 deletions
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