net: dsa: mt7530: make some noise if register read fails
authorDaniel Golle <daniel@makrotopia.org>
Mon, 3 Apr 2023 01:17:19 +0000 (02:17 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 3 Apr 2023 09:13:00 +0000 (10:13 +0100)
Simply returning the negative error value instead of the read value
doesn't seem like a good idea. Return 0 instead and add WARN_ON_ONCE(1)
so this kind of error will not go unnoticed.

Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mt7530.c

index a0d99af..18d4aa6 100644 (file)
@@ -224,9 +224,10 @@ mt7530_mii_read(struct mt7530_priv *priv, u32 reg)
        /* MT7530 uses 31 as the pseudo port */
        ret = bus->write(bus, 0x1f, 0x1f, page);
        if (ret < 0) {
+               WARN_ON_ONCE(1);
                dev_err(&bus->dev,
                        "failed to read mt7530 register\n");
-               return ret;
+               return 0;
        }
 
        lo = bus->read(bus, 0x1f, r);