Commit 4ec850e5 authored by Kangjie Lu's avatar Kangjie Lu Committed by David S. Miller

net: dwmac-sun8i: fix a missing check of of_get_phy_mode

of_get_phy_mode may fail and return a negative error code;
the fix checks the return value of of_get_phy_mode and
returns -EINVAL of it fails.
Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
Acked-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 035a14e7
...@@ -1147,7 +1147,10 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) ...@@ -1147,7 +1147,10 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
return ret; return ret;
} }
plat_dat->interface = of_get_phy_mode(dev->of_node); ret = of_get_phy_mode(dev->of_node);
if (ret < 0)
return -EINVAL;
plat_dat->interface = ret;
/* platform data specifying hardware features and callbacks. /* platform data specifying hardware features and callbacks.
* hardware features were copied from Allwinner drivers. * hardware features were copied from Allwinner drivers.
......
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