diff mbox series

[net-next] net: phy: swphy: Only warn once for unknown speed

Message ID 20221201202254.561103-1-sean.anderson@seco.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: phy: swphy: Only warn once for unknown speed | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Sean Anderson Dec. 1, 2022, 8:22 p.m. UTC
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(-)

Comments

Andrew Lunn Dec. 1, 2022, 8:48 p.m. UTC | #1
On Thu, Dec 01, 2022 at 03:22:53PM -0500, Sean Anderson wrote:
> 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.

Hi Sean

How did you trigger this? I have a patch in this area as well, which i
want Russells opinion on. I'm wondering if we are hitting the same
problem.

	Andrew
diff mbox series

Patch

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;