Skip to content

Commit

Permalink
net: dsa: warn if phylink_mac_link_state returns error
Browse files Browse the repository at this point in the history
Issue a warning to the kernel log if phylink_mac_link_state() returns
an error. This should not occur, but let's make it visible.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Russell King authored and David S. Miller committed Mar 16, 2020
1 parent 3c04d35 commit 87615c9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/dsa/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,15 +457,20 @@ static void dsa_port_phylink_mac_pcs_get_state(struct phylink_config *config,
{
struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
struct dsa_switch *ds = dp->ds;
int err;

/* Only called for inband modes */
if (!ds->ops->phylink_mac_link_state) {
state->link = 0;
return;
}

if (ds->ops->phylink_mac_link_state(ds, dp->index, state) < 0)
err = ds->ops->phylink_mac_link_state(ds, dp->index, state);
if (err < 0) {
dev_err(ds->dev, "p%d: phylink_mac_link_state() failed: %d\n",
dp->index, err);
state->link = 0;
}
}

static void dsa_port_phylink_mac_config(struct phylink_config *config,
Expand Down

0 comments on commit 87615c9

Please sign in to comment.