Message ID | 20250324135310.113824-1-o.rempel@pengutronix.de (mailing list archive) |
---|---|
State | New |
Delegated to: | Michal Kubecek |
Headers | show |
Series | [ethtool,v1,1/1] ethtool: fix incorrect MDI-X "Unknown" output for MDI mode | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
diff --git a/common.c b/common.c index 4fda4b49d2fd..1ba27e7577b4 100644 --- a/common.c +++ b/common.c @@ -171,6 +171,8 @@ void dump_mdix(u8 mdix, u8 mdix_ctrl) mdi_x_forced = true; } else { switch (mdix) { + case ETH_TP_MDI: + break; case ETH_TP_MDI_X: mdi_x = true; break;
Add a missing case to handle the MDI mode correctly when showing the current MDI/MDI-X status. Without this, the code may show "Unknown" even when the status is valid. This regression was introduced in commit bd1341cd2146 ("add json support for base command"). The logic assumed that `mdi_x = false` was already set at function start and omitted the `case ETH_TP_MDI:` branch in the switch statement. However, without an explicit `break`, the code continued into the default case, resulting in "Unknown" being printed even when the mode was valid. This patch adds a missing `case ETH_TP_MDI:` with an explicit `break` to avoid falling into the default case. As a result, users will now correctly see `MDI-X: off` instead of `Unknown` when the resolved state is MDI. Fixes: bd1341cd2146 ("add json support for base command") Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> --- common.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.39.5