Commit 262553b0 authored by Fabio Estevam's avatar Fabio Estevam Committed by Stefan Bader

net: fec: Do not use netdev messages too early

BugLink: https://bugs.launchpad.net/bugs/1840081

[ Upstream commit a19a0582 ]

When a valid MAC address is not found the current messages
are shown:

fec 2188000.ethernet (unnamed net_device) (uninitialized): Invalid MAC address: 00:00:00:00:00:00
fec 2188000.ethernet (unnamed net_device) (uninitialized): Using random MAC address: aa:9f:25:eb:7e:aa

Since the network device has not been registered at this point, it is better
to use dev_err()/dev_info() instead, which will provide cleaner log
messages like these:

fec 2188000.ethernet: Invalid MAC address: 00:00:00:00:00:00
fec 2188000.ethernet: Using random MAC address: aa:9f:25:eb:7e:aa

Tested on a imx6dl-pico-pi board.
Signed-off-by: default avatarFabio Estevam <festevam@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 945f694d
...@@ -1699,10 +1699,10 @@ static void fec_get_mac(struct net_device *ndev) ...@@ -1699,10 +1699,10 @@ static void fec_get_mac(struct net_device *ndev)
*/ */
if (!is_valid_ether_addr(iap)) { if (!is_valid_ether_addr(iap)) {
/* Report it and use a random ethernet address instead */ /* Report it and use a random ethernet address instead */
netdev_err(ndev, "Invalid MAC address: %pM\n", iap); dev_err(&fep->pdev->dev, "Invalid MAC address: %pM\n", iap);
eth_hw_addr_random(ndev); eth_hw_addr_random(ndev);
netdev_info(ndev, "Using random MAC address: %pM\n", dev_info(&fep->pdev->dev, "Using random MAC address: %pM\n",
ndev->dev_addr); ndev->dev_addr);
return; return;
} }
......
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