diff options
author | Sungbo Eo <mans0n@gorani.run> | 2020-04-25 17:35:53 +0900 |
---|---|---|
committer | Chuanhong Guo <gch981213@gmail.com> | 2020-05-19 19:03:07 +0800 |
commit | f7112a180f3655c56fb2c31eff286ee98983ca45 (patch) | |
tree | 2e53042c590991874603fc96438eb9a0749fb9c8 /target | |
parent | 0a05d71f6f34d2e9101fa40e9643d4f7bc8e7501 (diff) | |
download | upstream-f7112a180f3655c56fb2c31eff286ee98983ca45.tar.gz upstream-f7112a180f3655c56fb2c31eff286ee98983ca45.tar.bz2 upstream-f7112a180f3655c56fb2c31eff286ee98983ca45.zip |
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>
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c index 7191a7a382..358a8fc16d 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c @@ -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 */ |