mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-23 12:43:55 +08:00
dpaa2-eth: fix an always true condition in dpaa2_mac_get_if_mode
Convert the phy_mode() function to return the if_mode through an
argument, similar to the new form of of_get_phy_mode().
This will help with handling errors in a common manner and also will fix
an always true condition.
Fixes: 0c65b2b90d
("net: of_get_phy_mode: Change API to solve int/unit warnings")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
90ce9f23a8
commit
226df3ef1c
@ -7,14 +7,19 @@
|
|||||||
#define phylink_to_dpaa2_mac(config) \
|
#define phylink_to_dpaa2_mac(config) \
|
||||||
container_of((config), struct dpaa2_mac, phylink_config)
|
container_of((config), struct dpaa2_mac, phylink_config)
|
||||||
|
|
||||||
static phy_interface_t phy_mode(enum dpmac_eth_if eth_if)
|
static int phy_mode(enum dpmac_eth_if eth_if, phy_interface_t *if_mode)
|
||||||
{
|
{
|
||||||
|
*if_mode = PHY_INTERFACE_MODE_NA;
|
||||||
|
|
||||||
switch (eth_if) {
|
switch (eth_if) {
|
||||||
case DPMAC_ETH_IF_RGMII:
|
case DPMAC_ETH_IF_RGMII:
|
||||||
return PHY_INTERFACE_MODE_RGMII;
|
*if_mode = PHY_INTERFACE_MODE_RGMII;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Caller must call of_node_put on the returned value */
|
/* Caller must call of_node_put on the returned value */
|
||||||
@ -51,11 +56,11 @@ static int dpaa2_mac_get_if_mode(struct device_node *node,
|
|||||||
if (!err)
|
if (!err)
|
||||||
return if_mode;
|
return if_mode;
|
||||||
|
|
||||||
if_mode = phy_mode(attr.eth_if);
|
err = phy_mode(attr.eth_if, &if_mode);
|
||||||
if (if_mode >= 0)
|
if (!err)
|
||||||
return if_mode;
|
return if_mode;
|
||||||
|
|
||||||
return -ENODEV;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool dpaa2_mac_phy_mode_mismatch(struct dpaa2_mac *mac,
|
static bool dpaa2_mac_phy_mode_mismatch(struct dpaa2_mac *mac,
|
||||||
|
Loading…
Reference in New Issue
Block a user