提交 fadac406 编写于 作者: G Gabriel Paubert 提交者: Jeff Garzik

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 84dd619e.

This patch fixes the bug by setting mp->port_num prior to calling
eth_port_uc_get_addr().
Signed-off-by: NGabriel Paubert <paubert@iram.es>
Signed-off-by: NDale Farnsworth <dale@farnsworth.org>
Signed-off-by: NJeff Garzik <jeff@garzik.org>
上级 3ba4d093
...@@ -1379,7 +1379,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev) ...@@ -1379,7 +1379,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
spin_lock_init(&mp->lock); spin_lock_init(&mp->lock);
port_num = pd->port_number; port_num = mp->port_num = pd->port_number;
/* set default config values */ /* set default config values */
eth_port_uc_addr_get(dev, dev->dev_addr); eth_port_uc_addr_get(dev, dev->dev_addr);
...@@ -1411,8 +1411,6 @@ static int mv643xx_eth_probe(struct platform_device *pdev) ...@@ -1411,8 +1411,6 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
duplex = pd->duplex; duplex = pd->duplex;
speed = pd->speed; speed = pd->speed;
mp->port_num = port_num;
/* Hook up MII support for ethtool */ /* Hook up MII support for ethtool */
mp->mii.dev = dev; mp->mii.dev = dev;
mp->mii.mdio_read = mv643xx_mdio_read; mp->mii.mdio_read = mv643xx_mdio_read;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册