mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 21:58:04 +00:00
ramips: 5.4: handle ERR_PTR properly
of_get_mac_address can return ERR_PTR since 5.2, so the return pointer should be checked before used. Otherwise it might cause an oops during boot. Signed-off-by: Sungbo Eo <mans0n@gorani.run>
This commit is contained in:
parent
0a05d71f6f
commit
f7112a180f
@ -1401,7 +1401,7 @@ static int __init fe_init(struct net_device *dev)
|
||||
fe_reset_phy(priv);
|
||||
|
||||
mac_addr = of_get_mac_address(priv->dev->of_node);
|
||||
if (mac_addr)
|
||||
if (!IS_ERR_OR_NULL(mac_addr))
|
||||
ether_addr_copy(dev->dev_addr, mac_addr);
|
||||
|
||||
/* If the mac address is invalid, use random mac address */
|
||||
|
Loading…
Reference in New Issue
Block a user