Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a51645f7 authored by Petr Štetiar's avatar Petr Štetiar Committed by David S. Miller
Browse files

net: ethernet: support of_get_mac_address new ERR_PTR error



There was NVMEM support added to of_get_mac_address, so it could now
return ERR_PTR encoded error values, so we need to adjust all current
users of of_get_mac_address to this new fact.

While at it, remove superfluous is_valid_ether_addr as the MAC address
returned from of_get_mac_address is always valid and checked by
is_valid_ether_addr anyway.

Fixes: d01f449c ("of_net: add NVMEM support to of_get_mac_address")
Signed-off-by: default avatarPetr Štetiar <ynezz@true.cz>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5503a688
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1459,7 +1459,7 @@ static int greth_of_probe(struct platform_device *ofdev)
		const u8 *addr;

		addr = of_get_mac_address(ofdev->dev.of_node);
		if (addr) {
		if (!IS_ERR(addr)) {
			for (i = 0; i < 6; i++)
				macaddr[i] = (unsigned int) addr[i];
		} else {
+1 −1
Original line number Diff line number Diff line
@@ -870,7 +870,7 @@ static int emac_probe(struct platform_device *pdev)

	/* Read MAC-address from DT */
	mac_addr = of_get_mac_address(np);
	if (mac_addr)
	if (!IS_ERR(mac_addr))
		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);

	/* Check if the MAC address is valid, if not get a random one */
+1 −1
Original line number Diff line number Diff line
@@ -1537,7 +1537,7 @@ static int altera_tse_probe(struct platform_device *pdev)

	/* get default MAC address from device tree */
	macaddr = of_get_mac_address(pdev->dev.of_node);
	if (macaddr)
	if (!IS_ERR(macaddr))
		ether_addr_copy(ndev->dev_addr, macaddr);
	else
		eth_hw_addr_random(ndev);
+1 −1
Original line number Diff line number Diff line
@@ -960,7 +960,7 @@ int arc_emac_probe(struct net_device *ndev, int interface)
	/* Get MAC address from device tree */
	mac_addr = of_get_mac_address(dev->of_node);

	if (mac_addr)
	if (!IS_ERR(mac_addr))
		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
	else
		eth_hw_addr_random(ndev);
+1 −1
Original line number Diff line number Diff line
@@ -1463,7 +1463,7 @@ static int nb8800_probe(struct platform_device *pdev)
	dev->irq = irq;

	mac = of_get_mac_address(pdev->dev.of_node);
	if (mac)
	if (!IS_ERR(mac))
		ether_addr_copy(dev->dev_addr, mac);

	if (!is_valid_ether_addr(dev->dev_addr))
Loading