summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2019-05-31 19:14:44 +0200
committerDavid S. Miller <davem@davemloft.net>2019-06-02 18:11:57 -0700
commitdb4bad07371b53dbce34e8ae54d4aa93096841d6 (patch)
tree464fc1b9b764fe37f7f15af89dea43db42c6c62e
parentfeb3cf2e5ecc5840e27f328e0ce666a0f728f1a3 (diff)
downloadlinux-db4bad07371b53dbce34e8ae54d4aa93096841d6.tar.gz
linux-db4bad07371b53dbce34e8ae54d4aa93096841d6.tar.bz2
linux-db4bad07371b53dbce34e8ae54d4aa93096841d6.zip
net: ethernet: improve eth_platform_get_mac_address
pci_device_to_OF_node(to_pci_dev(dev)) is the same as dev->of_node, so we can simplify the code. In addition add an empty line before the return statement. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ethernet/eth.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 4b2b222377ac..b70d5482997a 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -549,17 +549,10 @@ unsigned char * __weak arch_get_platform_mac_address(void)
int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr)
{
- const unsigned char *addr;
- struct device_node *dp;
+ const unsigned char *addr = NULL;
- if (dev_is_pci(dev))
- dp = pci_device_to_OF_node(to_pci_dev(dev));
- else
- dp = dev->of_node;
-
- addr = NULL;
- if (dp)
- addr = of_get_mac_address(dp);
+ if (dev->of_node)
+ addr = of_get_mac_address(dev->of_node);
if (IS_ERR_OR_NULL(addr))
addr = arch_get_platform_mac_address();
@@ -567,6 +560,7 @@ int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr)
return -ENODEV;
ether_addr_copy(mac_addr, addr);
+
return 0;
}
EXPORT_SYMBOL(eth_platform_get_mac_address);