提交 604104fc 编写于 作者: M Madalin Bucur

fsl/fman: check of_get_phy_mode() return value

For unknown compatibles avoid crashing and default to SGMII.
Signed-off-by: NMadalin Bucur <madalin.bucur@nxp.com>
上级 47256192
...@@ -663,6 +663,7 @@ static int mac_probe(struct platform_device *_of_dev) ...@@ -663,6 +663,7 @@ static int mac_probe(struct platform_device *_of_dev)
const u8 *mac_addr; const u8 *mac_addr;
u32 val; u32 val;
u8 fman_id; u8 fman_id;
int phy_if;
dev = &_of_dev->dev; dev = &_of_dev->dev;
mac_node = dev->of_node; mac_node = dev->of_node;
...@@ -842,13 +843,14 @@ static int mac_probe(struct platform_device *_of_dev) ...@@ -842,13 +843,14 @@ static int mac_probe(struct platform_device *_of_dev)
} }
/* Get the PHY connection type */ /* Get the PHY connection type */
priv->phy_if = of_get_phy_mode(mac_node); phy_if = of_get_phy_mode(mac_node);
if (priv->phy_if < 0) { if (phy_if < 0) {
dev_warn(dev, dev_warn(dev,
"of_get_phy_mode() for %s failed. Defaulting to MII\n", "of_get_phy_mode() for %s failed. Defaulting to SGMII\n",
mac_node->full_name); mac_node->full_name);
priv->phy_if = PHY_INTERFACE_MODE_MII; phy_if = PHY_INTERFACE_MODE_SGMII;
} }
priv->phy_if = phy_if;
priv->speed = phy2speed[priv->phy_if]; priv->speed = phy2speed[priv->phy_if];
priv->max_speed = priv->speed; priv->max_speed = priv->speed;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册