ibm_newemac: Call dev_set_drvdata() before tah_reset()
authorValentine Barshak <vbarshak@ru.mvista.com>
Wed, 5 Dec 2007 00:14:32 +0000 (11:14 +1100)
committerJeff Garzik <jeff@garzik.org>
Fri, 7 Dec 2007 20:09:06 +0000 (15:09 -0500)
The patch moves dev_set_drvdata(&ofdev->dev, dev) up before tah_reset(ofdev)
is called to avoid a NULL pointer dereference, since tah_reset uses drvdata.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/ibm_newemac/tah.c

index f161fb100e8e671f1ec41a200fac023906eae058..6e35cbe15931c69038079452a886eb0a138359b0 100644 (file)
@@ -116,13 +116,14 @@ static int __devinit tah_probe(struct of_device *ofdev,
                goto err_free;
        }
 
+       dev_set_drvdata(&ofdev->dev, dev);
+
        /* Initialize TAH and enable IPv4 checksum verification, no TSO yet */
        tah_reset(ofdev);
 
        printk(KERN_INFO
               "TAH %s initialized\n", ofdev->node->full_name);
        wmb();
-       dev_set_drvdata(&ofdev->dev, dev);
 
        return 0;