diff options
author | Jason Liu <r64343@freescale.com> | 2010-08-05 16:07:00 +0800 |
---|---|---|
committer | Alan Tull <r80115@freescale.com> | 2010-09-25 09:50:24 -0500 |
commit | a2ebe76cc916bad2b1fae12985fbc3c544bb0dd9 (patch) | |
tree | 92da9f67f50a522832f86892a5e8c6ab07b3f617 /drivers | |
parent | b1b4d183945e50b9b24fb6e49a1c73589070b648 (diff) |
ENGR00125986 FEC:Fix kernel oops for mac address set up
There is no fec platform data for MX51 EVK board, so
memcpy(fec_mac_default, pdata->mac, sizeof(fec_mac_default));
will cause memory issues and lead to the following oops:
FEC Ethernet Driver
Unable to handle kernel NULL pointer dereference at virtual address 00000004
pgd = 80004000
[00000004] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT
Modules linked in:
CPU: 0 Not tainted (2.6.31-00836-gb471a66 #233)
PC is at memcpy+0x8c/0x330
This patch fix this issue which induced by commit
1f128b74b0dad4596ece46baf242562b093d2544
Signed-off-by:Jason Liu <r64343@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/fec.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 8fcc931fc3c3..743759587985 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c @@ -1396,6 +1396,17 @@ fec_probe(struct platform_device *pdev) ret = pdata->init(); if (ret) goto failed_platform_init; + /* + * The priority for getting MAC address is: + * (1) kernel command line fec_mac = xx:xx:xx... + * (2) platform data mac field got from fuse etc + * (3) bootloader set the FEC mac register + */ + + if (pdata && !is_valid_ether_addr(fec_mac_default) && + pdata->mac && is_valid_ether_addr(pdata->mac)) + memcpy(fec_mac_default, pdata->mac, + sizeof(fec_mac_default)); ret = fec_enet_init(ndev, 0); if (ret) |