aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mv643xx_eth.c
diff options
context:
space:
mode:
authorGabriel Paubert <paubert@iram.es>2007-03-23 15:03:52 -0400
committerJeff Garzik <jeff@garzik.org>2007-03-28 02:18:51 -0400
commitfadac4060c0456ce0a190ee581746ae8663f84e1 (patch)
tree2d8c5f910214dbb4e911c97ce0f5813f0f5d7ca6 /drivers/net/mv643xx_eth.c
parent3ba4d093fe8a26f5f2da94411bf8732fa6e9da86 (diff)
mv643xx_eth: Fix use of uninitialized port_num field
In this driver, the default ethernet address is first set by by calling eth_port_uc_addr_get() which reads the relevant registers of the corresponding port as initially set by firmware. However that function used the port_num field accessed through the private area of net_dev before it was set. The result was that one board I have ended up with the unicast address set to 00:00:00:00:00:00 (only port 1 is connected on this board). The problem appeared after commit 84dd619e4dc3b0b1c40dafd98c90fd950bce7bc5. This patch fixes the bug by setting mp->port_num prior to calling eth_port_uc_get_addr(). Signed-off-by: Gabriel Paubert <paubert@iram.es> Signed-off-by: Dale Farnsworth <dale@farnsworth.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/mv643xx_eth.c')
-rw-r--r--drivers/net/mv643xx_eth.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index c9f55bc57edb..8015a7c5b0c9 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1379,7 +1379,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
1379 1379
1380 spin_lock_init(&mp->lock); 1380 spin_lock_init(&mp->lock);
1381 1381
1382 port_num = pd->port_number; 1382 port_num = mp->port_num = pd->port_number;
1383 1383
1384 /* set default config values */ 1384 /* set default config values */
1385 eth_port_uc_addr_get(dev, dev->dev_addr); 1385 eth_port_uc_addr_get(dev, dev->dev_addr);
@@ -1411,8 +1411,6 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
1411 duplex = pd->duplex; 1411 duplex = pd->duplex;
1412 speed = pd->speed; 1412 speed = pd->speed;
1413 1413
1414 mp->port_num = port_num;
1415
1416 /* Hook up MII support for ethtool */ 1414 /* Hook up MII support for ethtool */
1417 mp->mii.dev = dev; 1415 mp->mii.dev = dev;
1418 mp->mii.mdio_read = mv643xx_mdio_read; 1416 mp->mii.mdio_read = mv643xx_mdio_read;