diff options
author | Wolfgang Denk <wd@denx.de> | 2008-07-31 13:57:20 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-07-31 13:57:20 +0200 |
commit | c4ec6db074051d2f6fc76a66411c60621b22bc02 (patch) | |
tree | 5d13653c35493e54423270b1dd96d58930adc136 /drivers | |
parent | f7c602ac8be0bcff4e573052c47e79bc46dab380 (diff) | |
download | u-boot-imx-c4ec6db074051d2f6fc76a66411c60621b22bc02.zip u-boot-imx-c4ec6db074051d2f6fc76a66411c60621b22bc02.tar.gz u-boot-imx-c4ec6db074051d2f6fc76a66411c60621b22bc02.tar.bz2 |
E1000: clean up CONFIG_E1000_FALLBACK_MAC handling
Avoid "integer constant is too large for 'long' type" warnings.
And simplify the code.
Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/e1000.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index 060b518..c8b4e98 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -513,9 +513,11 @@ e1000_read_mac_addr(struct eth_device *nic) nic->enetaddr[5] += 1; } #ifdef CONFIG_E1000_FALLBACK_MAC - if ( *(u32*)(nic->enetaddr) == 0 || *(u32*)(nic->enetaddr) == ~0 ) - for ( i=0; i < NODE_ADDRESS_SIZE; i++ ) - nic->enetaddr[i] = (CONFIG_E1000_FALLBACK_MAC >> (8*(5-i))) & 0xff; + if ( *(u32*)(nic->enetaddr) == 0 || *(u32*)(nic->enetaddr) == ~0 ) { + unsigned char fb_mac[NODE_ADDRESS_SIZE] = CONFIG_E1000_FALLBACK_MAC; + + memcpy (nic->enetaddr, fb_mac, NODE_ADDRESS_SIZE); + } #endif #else /* @@ -531,10 +533,9 @@ e1000_read_mac_addr(struct eth_device *nic) DEBUGFUNC(); s = getenv ("ethaddr"); - if (s == NULL){ + if (s == NULL) { return -E1000_ERR_EEPROM; - } - else{ + } else { for(ii = 0; ii < 6; ii++) { nic->enetaddr[ii] = s ? simple_strtoul (s, &e, 16) : 0; if (s){ |