diff options
author | Antoine Tenart <antoine.tenart@bootlin.com> | 2019-06-21 17:26:35 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-06-24 17:57:41 +0200 |
commit | 2bf4ecbcc7d837903c5967c9274f41b1ad29d530 (patch) | |
tree | 0e9d36e2d5bd5c293e46dd6e3a1f834d141d05c2 /drivers/net/ethernet/cadence | |
parent | net/packet: fix memory leak in packet_set_ring() (diff) | |
download | linux-2bf4ecbcc7d837903c5967c9274f41b1ad29d530.tar.xz linux-2bf4ecbcc7d837903c5967c9274f41b1ad29d530.zip |
net: macb: do not copy the mac address if NULL
This patch fixes the MAC address setup in the probe. The MAC address
retrieved using of_get_mac_address was checked for not containing an
error, but it may also be NULL which wasn't tested. Fix it by replacing
IS_ERR with IS_ERR_OR_NULL.
Fixes: 541ddc66d665 ("net: macb: support of_get_mac_address new ERR_PTR error")
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cadence')
-rw-r--r-- | drivers/net/ethernet/cadence/macb_main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 2375a13bb446..262a28ff81fc 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4180,7 +4180,7 @@ static int macb_probe(struct platform_device *pdev) if (PTR_ERR(mac) == -EPROBE_DEFER) { err = -EPROBE_DEFER; goto err_out_free_netdev; - } else if (!IS_ERR(mac)) { + } else if (!IS_ERR_OR_NULL(mac)) { ether_addr_copy(bp->dev->dev_addr, mac); } else { macb_get_hwaddr(bp); |