aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/bcm63xx/boards/board_bcm963xx.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index ea4ea77c6297..442ba96d4004 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -720,7 +720,7 @@ const char *board_get_name(void)
720 */ 720 */
721static int board_get_mac_address(u8 *mac) 721static int board_get_mac_address(u8 *mac)
722{ 722{
723 u8 *p; 723 u8 *oui;
724 int count; 724 int count;
725 725
726 if (mac_addr_used >= nvram.mac_addr_count) { 726 if (mac_addr_used >= nvram.mac_addr_count) {
@@ -729,21 +729,23 @@ static int board_get_mac_address(u8 *mac)
729 } 729 }
730 730
731 memcpy(mac, nvram.mac_addr_base, ETH_ALEN); 731 memcpy(mac, nvram.mac_addr_base, ETH_ALEN);
732 p = mac + ETH_ALEN - 1; 732 oui = mac + ETH_ALEN/2 - 1;
733 count = mac_addr_used; 733 count = mac_addr_used;
734 734
735 while (count--) { 735 while (count--) {
736 u8 *p = mac + ETH_ALEN - 1;
737
736 do { 738 do {
737 (*p)++; 739 (*p)++;
738 if (*p != 0) 740 if (*p != 0)
739 break; 741 break;
740 p--; 742 p--;
741 } while (p != mac); 743 } while (p != oui);
742 }
743 744
744 if (p == mac) { 745 if (p == oui) {
745 printk(KERN_ERR PFX "unable to fetch mac address\n"); 746 printk(KERN_ERR PFX "unable to fetch mac address\n");
746 return -ENODEV; 747 return -ENODEV;
748 }
747 } 749 }
748 750
749 mac_addr_used++; 751 mac_addr_used++;