ar71xx: add support for TP-Link TL-WR942N v1
[openwrt/openwrt.git] / target / linux / ar71xx / files / arch / mips / ath79 / nvram.c
index e55af5abe223b403dd3f8c795038a27f9297d47e..a1de55fb19937c9cb67c40731e456b88d9f18337 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/string.h>
+#include <linux/etherdevice.h>
 
 #include "nvram.h"
 
@@ -67,7 +68,11 @@ int ath79_nvram_parse_mac_addr(const char *nvram, unsigned nvram_len,
        t = sscanf(mac_str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
                   &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
 
-       if (t != 6) {
+       if (t != ETH_ALEN)
+               t = sscanf(mac_str, "%02hhx-%02hhx-%02hhx-%02hhx-%02hhx-%02hhx",
+                       &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
+
+       if (t != ETH_ALEN) {
                ret = -EINVAL;
                goto free;
        }