From 4d58a3918b6334be0db3ce098c24f37ca79ed33a Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 23 Jul 2010 03:18:07 +0000 Subject: [PATCH] --- yaml --- r: 203690 b: refs/heads/master c: 5c4ac8c60aba4b2e9549d139586612855b0fea09 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/net/ksz884x.c | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 63997ee5cd31..5f8ddae00238 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2b27822ff8f257f810761c3d23e8104d1404cf3b +refs/heads/master: 5c4ac8c60aba4b2e9549d139586612855b0fea09 diff --git a/trunk/drivers/net/ksz884x.c b/trunk/drivers/net/ksz884x.c index b3c010b85658..8b32cc107f0f 100644 --- a/trunk/drivers/net/ksz884x.c +++ b/trunk/drivers/net/ksz884x.c @@ -6894,13 +6894,12 @@ static void get_mac_addr(struct dev_info *hw_priv, u8 *macaddr, int port) i = j = num = got_num = 0; while (j < MAC_ADDR_LEN) { if (macaddr[i]) { + int digit; + got_num = 1; - if ('0' <= macaddr[i] && macaddr[i] <= '9') - num = num * 16 + macaddr[i] - '0'; - else if ('A' <= macaddr[i] && macaddr[i] <= 'F') - num = num * 16 + 10 + macaddr[i] - 'A'; - else if ('a' <= macaddr[i] && macaddr[i] <= 'f') - num = num * 16 + 10 + macaddr[i] - 'a'; + digit = hex_to_bin(macaddr[i]); + if (digit >= 0) + num = num * 16 + digit; else if (':' == macaddr[i]) got_num = 2; else