diff options
| author | Kangjie Lu <kjlu@umn.edu> | 2019-03-12 03:50:40 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2019-03-12 17:52:00 -0400 |
| commit | 4ec850e5dfec092b26cf3b7d5a6c9e444ea4babd (patch) | |
| tree | 25d09ed2f4437df2ad9d09977884275678e8af7a | |
| parent | 035a14e71f27eefa50087963b94cbdb3580d08bf (diff) | |
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: Kangjie Lu <kjlu@umn.edu>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c index 0f660af01a4b..195669f550f0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | |||
| @@ -1147,7 +1147,10 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) | |||
| 1147 | return ret; | 1147 | return ret; |
| 1148 | } | 1148 | } |
| 1149 | 1149 | ||
| 1150 | plat_dat->interface = of_get_phy_mode(dev->of_node); | 1150 | ret = of_get_phy_mode(dev->of_node); |
| 1151 | if (ret < 0) | ||
| 1152 | return -EINVAL; | ||
| 1153 | plat_dat->interface = ret; | ||
| 1151 | 1154 | ||
| 1152 | /* platform data specifying hardware features and callbacks. | 1155 | /* platform data specifying hardware features and callbacks. |
| 1153 | * hardware features were copied from Allwinner drivers. | 1156 | * hardware features were copied from Allwinner drivers. |
