Skip to content

Commit

Permalink
octeon_ep: ensure get mac address successfully before eth_hw_addr_set()
Browse files Browse the repository at this point in the history
octep_get_mac_addr() can fail because send mbox message failed. If this
happens, octep_dev->mac_addr will be zero. It should not continue to
initialize. Add exception handling for octep_get_mac_addr() to fix it.

Fixes: 862cd65 ("octeon_ep: Add driver framework and device initialization")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ziyang Xuan authored and David S. Miller committed Nov 14, 2022
1 parent e4041be commit 848ffce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/ethernet/marvell/octeon_ep/octep_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,11 @@ static int octep_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev->max_mtu = OCTEP_MAX_MTU;
netdev->mtu = OCTEP_DEFAULT_MTU;

octep_get_mac_addr(octep_dev, octep_dev->mac_addr);
err = octep_get_mac_addr(octep_dev, octep_dev->mac_addr);
if (err) {
dev_err(&pdev->dev, "Failed to get mac address\n");
goto register_dev_err;
}
eth_hw_addr_set(netdev, octep_dev->mac_addr);

err = register_netdev(netdev);
Expand Down

0 comments on commit 848ffce

Please sign in to comment.