lkml.org 
[lkml]   [2022]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH net-next] net: phy: swphy: Only warn once for unknown speed
Date
swphy_read_reg is called quite frequently during normal operation. If an
invalid speed is used for state, then it can turn dmesg into a firehose.
Although the first warn will likely contain a backtrace for the
offending driver, later warnings will usually just contain a backtrace
from the phy state machine. Just warn once.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

drivers/net/phy/swphy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/swphy.c b/drivers/net/phy/swphy.c
index 59f1ba4d49bc..9af155a25f23 100644
--- a/drivers/net/phy/swphy.c
+++ b/drivers/net/phy/swphy.c
@@ -124,7 +124,7 @@ int swphy_read_reg(int reg, const struct fixed_phy_status *state)
return -1;

speed_index = swphy_decode_speed(state->speed);
- if (WARN_ON(speed_index < 0))
+ if (WARN_ON_ONCE(speed_index < 0))
return 0;

duplex_index = state->duplex ? SWMII_DUPLEX_FULL : SWMII_DUPLEX_HALF;
--
2.35.1.1320.gc452695387.dirty
\
 
 \ /
  Last update: 2022-12-01 21:24    [W:0.043 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site