ffbdde5a5772ea89fd9145aa3e839872266755ae
[openwrt/staging/stintel.git] /
1 From b6f56cddb5f57a0b8da0ce582232a2f1933558c6 Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Mon, 3 Apr 2023 02:17:19 +0100
4 Subject: [PATCH 04/16] net: dsa: mt7530: make some noise if register read
5 fails
6
7 Simply returning the negative error value instead of the read value
8 doesn't seem like a good idea. Return 0 instead and add WARN_ON_ONCE(1)
9 so this kind of error will not go unnoticed.
10
11 Suggested-by: Andrew Lunn <andrew@lunn.ch>
12 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
13 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
15 ---
16 drivers/net/dsa/mt7530.c | 3 ++-
17 1 file changed, 2 insertions(+), 1 deletion(-)
18
19 --- a/drivers/net/dsa/mt7530.c
20 +++ b/drivers/net/dsa/mt7530.c
21 @@ -224,9 +224,10 @@ mt7530_mii_read(struct mt7530_priv *priv
22 /* MT7530 uses 31 as the pseudo port */
23 ret = bus->write(bus, 0x1f, 0x1f, page);
24 if (ret < 0) {
25 + WARN_ON_ONCE(1);
26 dev_err(&bus->dev,
27 "failed to read mt7530 register\n");
28 - return ret;
29 + return 0;
30 }
31
32 lo = bus->read(bus, 0x1f, r);