]> git.karo-electronics.de Git - linux-beck.git/commitdiff
dnet: fix wrong use of platform_set_drvdata()
authorIlya Yanok <yanok@emcraft.com>
Mon, 21 Feb 2011 10:20:30 +0000 (10:20 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Feb 2011 20:22:21 +0000 (12:22 -0800)
platform_set_drvdata() was used with argument of incorrect type and
could cause memory corruption. Moreover, because of not setting drvdata
in the correct place not all resources were freed upon module unload.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dnet.c

index 9d8a20b72fa9ecdaa694481f1c4151a5dd51ce3d..8318ea06cb6dcec33caedf56bdda6c2070a298c7 100644 (file)
@@ -337,8 +337,6 @@ static int dnet_mii_init(struct dnet *bp)
        for (i = 0; i < PHY_MAX_ADDR; i++)
                bp->mii_bus->irq[i] = PHY_POLL;
 
-       platform_set_drvdata(bp->dev, bp->mii_bus);
-
        if (mdiobus_register(bp->mii_bus)) {
                err = -ENXIO;
                goto err_out_free_mdio_irq;
@@ -863,6 +861,7 @@ static int __devinit dnet_probe(struct platform_device *pdev)
        bp = netdev_priv(dev);
        bp->dev = dev;
 
+       platform_set_drvdata(pdev, dev);
        SET_NETDEV_DEV(dev, &pdev->dev);
 
        spin_lock_init(&bp->lock);