]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/net/ethernet/pasemi/pasemi_mac.c
ethernet: Convert mac address uses of 6 to ETH_ALEN
[karo-tx-linux.git] / drivers / net / ethernet / pasemi / pasemi_mac.c
index a5f0b5da614933c74ebbf005edba139b4bb74b88..f21ae7b6c766c3353e33faeab6fd32a14270e0cf 100644 (file)
@@ -191,7 +191,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
        struct device_node *dn = pci_device_to_OF_node(pdev);
        int len;
        const u8 *maddr;
-       u8 addr[6];
+       u8 addr[ETH_ALEN];
 
        if (!dn) {
                dev_dbg(&pdev->dev,
@@ -201,8 +201,8 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
 
        maddr = of_get_property(dn, "local-mac-address", &len);
 
-       if (maddr && len == 6) {
-               memcpy(mac->mac_addr, maddr, 6);
+       if (maddr && len == ETH_ALEN) {
+               memcpy(mac->mac_addr, maddr, ETH_ALEN);
                return 0;
        }
 
@@ -219,14 +219,15 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
                return -ENOENT;
        }
 
-       if (sscanf(maddr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &addr[0],
-                  &addr[1], &addr[2], &addr[3], &addr[4], &addr[5]) != 6) {
+       if (sscanf(maddr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
+                  &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5])
+           != ETH_ALEN) {
                dev_warn(&pdev->dev,
                         "can't parse mac address, not configuring\n");
                return -EINVAL;
        }
 
-       memcpy(mac->mac_addr, addr, 6);
+       memcpy(mac->mac_addr, addr, ETH_ALEN);
 
        return 0;
 }