Commit 6115c11f authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

net: mv643xx_eth: potential NULL dereference in probe()

We assume that "mp->phy" can be NULL a couple lines before the
dereference.

Fixes: 1cce16d3 ('net: mv643xx_eth: Add missing phy_addr_set in DT mode')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Acked-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 64b8c8e5
......@@ -2890,7 +2890,8 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
PHY_INTERFACE_MODE_GMII);
if (!mp->phy)
err = -ENODEV;
phy_addr_set(mp, mp->phy->addr);
else
phy_addr_set(mp, mp->phy->addr);
} else if (pd->phy_addr != MV643XX_ETH_PHY_NONE) {
mp->phy = phy_scan(mp, pd->phy_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment