]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/6.8.6/net-pcs-xpcs-return-einval-in-the-internal-methods.patch
Linux 6.6.27
[thirdparty/kernel/stable-queue.git] / releases / 6.8.6 / net-pcs-xpcs-return-einval-in-the-internal-methods.patch
1 From b17e271ab7deee2a7db1e34dd3eea075e5713562 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Thu, 22 Feb 2024 20:58:22 +0300
4 Subject: net: pcs: xpcs: Return EINVAL in the internal methods
5
6 From: Serge Semin <fancer.lancer@gmail.com>
7
8 [ Upstream commit f5151005d379d9ce42e327fd3b2d2aaef61cda81 ]
9
10 In particular the xpcs_soft_reset() and xpcs_do_config() functions
11 currently return -1 if invalid auto-negotiation mode is specified. That
12 value might be then passed to the generic kernel subsystems which require
13 a standard kernel errno value. Even though the erroneous conditions are
14 very specific (memory corruption or buggy driver implementation) using a
15 hard-coded -1 literal doesn't seem correct anyway especially when it comes
16 to passing it higher to the network subsystem or printing to the system
17 log. Convert the hard-coded error values to -EINVAL then.
18
19 Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
20 Tested-by: Andrew Lunn <andrew@lunn.ch>
21 Signed-off-by: David S. Miller <davem@davemloft.net>
22 Signed-off-by: Sasha Levin <sashal@kernel.org>
23 ---
24 drivers/net/pcs/pcs-xpcs.c | 4 ++--
25 1 file changed, 2 insertions(+), 2 deletions(-)
26
27 diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
28 index 31f0beba638a2..03d6a6aef77cd 100644
29 --- a/drivers/net/pcs/pcs-xpcs.c
30 +++ b/drivers/net/pcs/pcs-xpcs.c
31 @@ -293,7 +293,7 @@ static int xpcs_soft_reset(struct dw_xpcs *xpcs,
32 dev = MDIO_MMD_VEND2;
33 break;
34 default:
35 - return -1;
36 + return -EINVAL;
37 }
38
39 ret = xpcs_write(xpcs, dev, MDIO_CTRL1, MDIO_CTRL1_RESET);
40 @@ -891,7 +891,7 @@ int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
41 return ret;
42 break;
43 default:
44 - return -1;
45 + return -EINVAL;
46 }
47
48 if (compat->pma_config) {
49 --
50 2.43.0
51