Skip to content

Commit

Permalink
ibm_newemac: Call dev_set_drvdata() before tah_reset()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Valentine Barshak authored and Jeff Garzik committed Dec 7, 2007
1 parent 63b6cad commit d09e18b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ibm_newemac/tah.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit d09e18b

Please sign in to comment.