netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: swphy: Only warn once for unknown speed
@ 2022-12-01 20:22 Sean Anderson
  2022-12-01 20:48 ` Andrew Lunn
  0 siblings, 1 reply; 2+ messages in thread
From: Sean Anderson @ 2022-12-01 20:22 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, netdev
  Cc: Eric Dumazet, linux-kernel, Paolo Abeni, David S . Miller,
	Jakub Kicinski, Sean Anderson

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-01 20:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-01 20:22 [PATCH net-next] net: phy: swphy: Only warn once for unknown speed Sean Anderson
2022-12-01 20:48 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).