Commit 361dd531 authored by Serge Semin's avatar Serge Semin Committed by David S. Miller

net: pcs: xpcs: Explicitly return error on caps validation

If an unsupported interface is passed to the PCS validation callback there
is no need in further link-modes calculations since the resultant array
will be initialized with zeros which will be perceived by the phylink
subsystem as error anyway (see phylink_validate_mac_and_pcs()). Instead
let's explicitly return the -EINVAL error to inform the caller about the
unsupported interface as it's done in the rest of the pcs_validate
callbacks.
Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
Reviewed-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f5151005
...@@ -613,12 +613,13 @@ static int xpcs_validate(struct phylink_pcs *pcs, unsigned long *supported, ...@@ -613,12 +613,13 @@ static int xpcs_validate(struct phylink_pcs *pcs, unsigned long *supported,
xpcs = phylink_pcs_to_xpcs(pcs); xpcs = phylink_pcs_to_xpcs(pcs);
compat = xpcs_find_compat(xpcs->id, state->interface); compat = xpcs_find_compat(xpcs->id, state->interface);
if (!compat)
return -EINVAL;
/* Populate the supported link modes for this PHY interface type. /* Populate the supported link modes for this PHY interface type.
* FIXME: what about the port modes and autoneg bit? This masks * FIXME: what about the port modes and autoneg bit? This masks
* all those away. * all those away.
*/ */
if (compat)
for (i = 0; compat->supported[i] != __ETHTOOL_LINK_MODE_MASK_NBITS; i++) for (i = 0; compat->supported[i] != __ETHTOOL_LINK_MODE_MASK_NBITS; i++)
set_bit(compat->supported[i], xpcs_supported); set_bit(compat->supported[i], xpcs_supported);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment