From: Valentine Barshak Date: Wed, 5 Dec 2007 00:14:32 +0000 (+1100) Subject: ibm_newemac: Call dev_set_drvdata() before tah_reset() X-Git-Tag: v2.6.24-rc5~27 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=d09e18bc194c3fa8ae880df4567c719c36a73e9e;p=linux-2.6-omap-h63xx.git ibm_newemac: Call dev_set_drvdata() before tah_reset() 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 Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/ibm_newemac/tah.c b/drivers/net/ibm_newemac/tah.c index f161fb100e8..6e35cbe1593 100644 --- a/drivers/net/ibm_newemac/tah.c +++ b/drivers/net/ibm_newemac/tah.c @@ -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;