MIPS: AR7: Replace mac address parsing
authorDaniel Walter <dwalter@google.com>
Tue, 24 Jun 2014 15:39:59 +0000 (16:39 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 2 Apr 2015 11:54:22 +0000 (13:54 +0200)
Replace sscanf() with mac_pton().

[ralf@linux-mips.org: Resolved conflict.]

Signed-off-by: Daniel Walter <dwalter@google.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7151/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/ar7/platform.c

index af2441dbfc127e5e93c2e07aab8ce2319cb20e5d..be9ff1673ded7f2d20bbffa7897b9ac70dcedb07 100644 (file)
@@ -307,10 +307,7 @@ static void __init cpmac_get_mac(int instance, unsigned char *dev_addr)
        }
 
        if (mac) {
-               if (sscanf(mac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
-                                       &dev_addr[0], &dev_addr[1],
-                                       &dev_addr[2], &dev_addr[3],
-                                       &dev_addr[4], &dev_addr[5]) != 6) {
+               if (!mac_pton(mac, dev_addr)) {
                        pr_warn("cannot parse mac address, using random address\n");
                        eth_random_addr(dev_addr);
                }