linux-mips
[Top] [All Lists]

[PATCH 1/1] ar7: replace mac address parsing

To: Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH 1/1] ar7: replace mac address parsing
From: Daniel Walter <dwalter@google.com>
Date: Tue, 24 Jun 2014 16:39:59 +0100
Cc: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=esh580jhtZbEbieOaQdHV3udSpX+iYvfjUHx9WOTC2A=; b=GU83bBIuRGcKc2Rhj2JD7bZYTcbTlFPxH+tyzVX5NhRcItOpbBbWOOgfflPD1NVKBS 6UkDp24dD/AeTvmvpS4YQn0nOsmYrtWZYYAyVhwZjr6rF/PjihZSGnhbrCDJuVD4trfF cBTBF2cPpKAJkFP6Qn/1jgVNdfh3CxwabH5ao0iRrKetgbAngQZpiaTEHDhqetE6tCfu wcImZ4FH+UYt7qs90Ydky3K+51JELaw3TvOEigSSBcFHCVMNnWAfX7RRNMhH9Ezb9vHH d9lTTkIYWGHXaPXbLxIG8pnpmXdKT8+catUKUXS9iO2D9k4awpiao3p3hxY477LLNFTD kXXw==
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.21 (2010-09-15)
Replace sscanf() with mac_pton().

Signed-off-by: Daniel Walter <dwalter@google.com>
---

 arch/mips/ar7/platform.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
---
diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
index 7e2356f..653cbff 100644
--- a/arch/mips/ar7/platform.c
+++ b/arch/mips/ar7/platform.c
@@ -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_warning("cannot parse mac address, "
                                        "using random address\n");
                        eth_random_addr(dev_addr);

<Prev in Thread] Current Thread [Next in Thread>