790-03-v6.4-net-dsa-mt7530-make-some-noise-if-register-read-fail.patch 1.0 KB

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