Commit da48be33 authored by Petr Štetiar's avatar Petr Štetiar Committed by David S. Miller

staging: octeon-ethernet: Fix of_get_mac_address ERR_PTR check

Commit 284eb160 ("staging: octeon-ethernet: support
of_get_mac_address new ERR_PTR error") has introduced checking for
ERR_PTR encoded error value from of_get_mac_address with IS_ERR macro,
which is not sufficient in this case, as the mac variable is set to NULL
initialy and if the kernel is compiled without DT support this NULL
would get passed to IS_ERR, which would lead to the wrong decision and
would pass that NULL pointer and invalid MAC address further.

Fixes: 284eb160 ("staging: octeon-ethernet: support of_get_mac_address new ERR_PTR error")
Signed-off-by: default avatarPetr Štetiar <ynezz@true.cz>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4974f9b7
...@@ -421,7 +421,7 @@ int cvm_oct_common_init(struct net_device *dev) ...@@ -421,7 +421,7 @@ int cvm_oct_common_init(struct net_device *dev)
if (priv->of_node) if (priv->of_node)
mac = of_get_mac_address(priv->of_node); mac = of_get_mac_address(priv->of_node);
if (!IS_ERR(mac)) if (!IS_ERR_OR_NULL(mac))
ether_addr_copy(dev->dev_addr, mac); ether_addr_copy(dev->dev_addr, mac);
else else
eth_hw_addr_random(dev); eth_hw_addr_random(dev);
......
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