Skip to content

Commit 1af8705

Browse files
ynezzclaudiubeznea
authored andcommitted
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: d01f449 ("of_net: add NVMEM support to of_get_mac_address") Signed-off-by: Petr Štetiar <ynezz@true.cz> Signed-off-by: David S. Miller <davem@davemloft.net> [claudiu.beznea@microchip.com: remove drivers/net/ethernet/lantiq_xrx200.c] Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
1 parent 3469987 commit 1af8705

44 files changed

Lines changed: 44 additions & 44 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

drivers/net/ethernet/aeroflex/greth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,7 @@ static int greth_of_probe(struct platform_device *ofdev)
14591459
const u8 *addr;
14601460

14611461
addr = of_get_mac_address(ofdev->dev.of_node);
1462-
if (addr) {
1462+
if (!IS_ERR(addr)) {
14631463
for (i = 0; i < 6; i++)
14641464
macaddr[i] = (unsigned int) addr[i];
14651465
} else {

drivers/net/ethernet/allwinner/sun4i-emac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ static int emac_probe(struct platform_device *pdev)
870870

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

876876
/* Check if the MAC address is valid, if not get a random one */

drivers/net/ethernet/altera/altera_tse_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1535,7 +1535,7 @@ static int altera_tse_probe(struct platform_device *pdev)
15351535

15361536
/* get default MAC address from device tree */
15371537
macaddr = of_get_mac_address(pdev->dev.of_node);
1538-
if (macaddr)
1538+
if (!IS_ERR(macaddr))
15391539
ether_addr_copy(ndev->dev_addr, macaddr);
15401540
else
15411541
eth_hw_addr_random(ndev);

drivers/net/ethernet/arc/emac_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ int arc_emac_probe(struct net_device *ndev, int interface)
959959
/* Get MAC address from device tree */
960960
mac_addr = of_get_mac_address(dev->of_node);
961961

962-
if (mac_addr)
962+
if (!IS_ERR(mac_addr))
963963
memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
964964
else
965965
eth_hw_addr_random(ndev);

drivers/net/ethernet/aurora/nb8800.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,7 @@ static int nb8800_probe(struct platform_device *pdev)
14681468
dev->irq = irq;
14691469

14701470
mac = of_get_mac_address(pdev->dev.of_node);
1471-
if (mac)
1471+
if (!IS_ERR(mac))
14721472
ether_addr_copy(dev->dev_addr, mac);
14731473

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

drivers/net/ethernet/broadcom/bcmsysport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2494,7 +2494,7 @@ static int bcm_sysport_probe(struct platform_device *pdev)
24942494

24952495
/* Initialize netdevice members */
24962496
macaddr = of_get_mac_address(dn);
2497-
if (!macaddr || !is_valid_ether_addr(macaddr)) {
2497+
if (IS_ERR(macaddr)) {
24982498
dev_warn(&pdev->dev, "using random Ethernet MAC\n");
24992499
eth_hw_addr_random(dev);
25002500
} else {

drivers/net/ethernet/broadcom/bgmac-bcma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static int bgmac_probe(struct bcma_device *core)
132132
mac = of_get_mac_address(bgmac->dev->of_node);
133133

134134
/* If no MAC address assigned via device tree, check SPROM */
135-
if (!mac) {
135+
if (IS_ERR_OR_NULL(mac)) {
136136
switch (core->core_unit) {
137137
case 0:
138138
mac = sprom->et0mac;

drivers/net/ethernet/broadcom/bgmac-platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static int bgmac_probe(struct platform_device *pdev)
193193
bgmac->dma_dev = &pdev->dev;
194194

195195
mac_addr = of_get_mac_address(np);
196-
if (mac_addr)
196+
if (!IS_ERR(mac_addr))
197197
ether_addr_copy(bgmac->net_dev->dev_addr, mac_addr);
198198
else
199199
dev_warn(&pdev->dev, "MAC address not present in device tree\n");

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3476,7 +3476,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
34763476

34773477
if (dn) {
34783478
macaddr = of_get_mac_address(dn);
3479-
if (!macaddr) {
3479+
if (IS_ERR(macaddr)) {
34803480
dev_err(&pdev->dev, "can't find MAC address\n");
34813481
err = -EINVAL;
34823482
goto err;

drivers/net/ethernet/cavium/octeon/octeon_mgmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ static int octeon_mgmt_probe(struct platform_device *pdev)
14991499

15001500
mac = of_get_mac_address(pdev->dev.of_node);
15011501

1502-
if (mac)
1502+
if (!IS_ERR(mac))
15031503
memcpy(netdev->dev_addr, mac, ETH_ALEN);
15041504
else
15051505
eth_hw_addr_random(netdev);

0 commit comments

Comments
 (0)