diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-05-15 15:08:27 -0700 |
---|---|---|
committer | Chris Wright <chrisw@sous-sol.org> | 2007-05-23 14:32:53 -0700 |
commit | b1b292459c99d06e90b109f04e2dbd184fda9167 (patch) | |
tree | 6c1179ecf9ce101a081b64f2545a318fb42e725e | |
parent | 71609984a43bab184a8f47eb34b15704cb7c0485 (diff) |
[PATCH] sky2: fix oops on shutdown
If the device fails during module startup for some reason like unsupported chip
version then the driver would crash dereferencing a null pointer, on shutdown
or suspend/resume.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
-rw-r--r-- | drivers/net/sky2.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 7d380d21354..b6b444b0aff 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -3719,6 +3719,7 @@ err_out_free_regions: pci_release_regions(pdev); pci_disable_device(pdev); err_out: + pci_set_drvdata(pdev, NULL); return err; } @@ -3771,6 +3772,9 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state) struct sky2_hw *hw = pci_get_drvdata(pdev); int i, wol = 0; + if (!hw) + return 0; + del_timer_sync(&hw->idle_timer); netif_poll_disable(hw->dev[0]); @@ -3802,6 +3806,9 @@ static int sky2_resume(struct pci_dev *pdev) struct sky2_hw *hw = pci_get_drvdata(pdev); int i, err; + if (!hw) + return 0; + err = pci_set_power_state(pdev, PCI_D0); if (err) goto out; @@ -3848,6 +3855,9 @@ static void sky2_shutdown(struct pci_dev *pdev) struct sky2_hw *hw = pci_get_drvdata(pdev); int i, wol = 0; + if (!hw) + return; + del_timer_sync(&hw->idle_timer); netif_poll_disable(hw->dev[0]); |