Messages in this thread Patch in this message | | | From | Sean Anderson <> | Subject | [PATCH net-next] net: phy: swphy: Only warn once for unknown speed | Date | Thu, 1 Dec 2022 15:22:53 -0500 |
| |
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
| |