Skip to content

Commit 4ec850e

Browse files
kengiterdavem330
authored andcommitted
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>
1 parent 035a14e commit 4ec850e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,10 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
11471147
return ret;
11481148
}
11491149

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;
11511154

11521155
/* platform data specifying hardware features and callbacks.
11531156
* hardware features were copied from Allwinner drivers.

0 commit comments

Comments
 (0)