[openwrt/openwrt] realtek: dsa: handle error returned by PCS

LEDE Commits lede-commits at lists.infradead.org
Sun Nov 2 07:32:14 PST 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/c447ba0a8387a0e55954387083a3c011749a96f0

commit c447ba0a8387a0e55954387083a3c011749a96f0
Author: Jonas Jelonek <jelonek.jonas at gmail.com>
AuthorDate: Mon Oct 27 18:46:08 2025 +0000

    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 at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/20577
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 .../linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c  | 10 ++++++++--
 1 file 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




More information about the lede-commits mailing list