generic: 5.10: replace ramips AR8033 fiber patch with 5.18 patches
[openwrt/openwrt.git] / target / linux / generic / backport-5.10 / 775-v5.18-05-net-phy-at803x-fix-error-return-code-in-at803x_probe.patch
1 From 1f0dd412e34e177621769866bef347f0b22364df Mon Sep 17 00:00:00 2001
2 From: Wei Yongjun <weiyongjun1@huawei.com>
3 Date: Fri, 18 Nov 2022 10:36:35 +0000
4 Subject: [PATCH] net: phy: at803x: fix error return code in at803x_probe()
5
6 Fix to return a negative error code from the ccr read error handling
7 case instead of 0, as done elsewhere in this function.
8
9 Fixes: 3265f4218878 ("net: phy: at803x: add fiber support")
10 Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
11 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
12 Link: https://lore.kernel.org/r/20221118103635.254256-1-weiyongjun@huaweicloud.com
13 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
14 ---
15 drivers/net/phy/at803x.c | 4 +++-
16 1 file changed, 3 insertions(+), 1 deletion(-)
17
18 --- a/drivers/net/phy/at803x.c
19 +++ b/drivers/net/phy/at803x.c
20 @@ -726,8 +726,10 @@ static int at803x_probe(struct phy_devic
21 int ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG);
22 int mode_cfg;
23
24 - if (ccr < 0)
25 + if (ccr < 0) {
26 + ret = ccr;
27 goto err;
28 + }
29 mode_cfg = ccr & AT803X_MODE_CFG_MASK;
30
31 switch (mode_cfg) {