]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
generic: backport pse-pd error check fix 23449/head
authorJonas Jelonek <jelonek.jonas@gmail.com>
Wed, 20 May 2026 08:16:06 +0000 (08:16 +0000)
committerRobert Marko <robimarko@gmail.com>
Wed, 20 May 2026 08:38:35 +0000 (10:38 +0200)
Backport a patch fixing the error return check when loading PSE PIs from
the DT tree in case the pairset property isn't specified.

This patch might be backported upstream in stable.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23449
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/generic/backport-6.18/627-v7.1-net-pse-pd-fix-sign-on-ENOENT-check-in-of_load_pse_p.patch [new file with mode: 0644]

diff --git a/target/linux/generic/backport-6.18/627-v7.1-net-pse-pd-fix-sign-on-ENOENT-check-in-of_load_pse_p.patch b/target/linux/generic/backport-6.18/627-v7.1-net-pse-pd-fix-sign-on-ENOENT-check-in-of_load_pse_p.patch
new file mode 100644 (file)
index 0000000..2ef6d58
--- /dev/null
@@ -0,0 +1,33 @@
+From 33d35975cbead3fa6b738ee57e5e45e14fbe0886 Mon Sep 17 00:00:00 2001
+From: Jonas Jelonek <jelonek.jonas@gmail.com>
+Date: Fri, 15 May 2026 14:31:03 +0000
+Subject: [PATCH] net: pse-pd: fix sign on -ENOENT check in of_load_pse_pis()
+
+of_count_phandle_with_args() returns the count on success and a negative
+errno on failure, including -ENOENT when the "pairsets" property is
+absent. The existing comparison in of_load_pse_pis() checks against
+ENOENT (positive 2) instead of -ENOENT, so the branch is taken for any
+error return: legitimate DTs that omit "pairsets" trigger a spurious
+"wrong number of pairsets" error and probe fails with -EINVAL.
+
+Compare against -ENOENT so a missing "pairsets" property is correctly
+treated as "this PI has no pairsets, continue".
+
+Fixes: 9be9567a7c59 ("net: pse-pd: Add support for PSE PIs")
+Cc: stable@vger.kernel.org
+Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
+Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
+Link: https://patch.msgid.link/20260515143103.1721888-1-jelonek.jonas@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+
+--- a/drivers/net/pse-pd/pse_core.c
++++ b/drivers/net/pse-pd/pse_core.c
+@@ -210,7 +210,7 @@ static int of_load_pse_pis(struct pse_co
+                       ret = of_load_pse_pi_pairsets(node, &pi, ret);
+                       if (ret)
+                               goto out;
+-              } else if (ret != ENOENT) {
++              } else if (ret != -ENOENT) {
+                       dev_err(pcdev->dev,
+                               "error: wrong number of pairsets. Should be 1 or 2, got %d (%pOF)\n",
+                               ret, node);