diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-05-11 14:21:44 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-05-11 17:53:33 -0400 |
commit | 549a68c3fe2ca320b0764d1289d17af797daa5d1 (patch) | |
tree | 0c9f4b729ba37f6c28b725f885dc5ac6b9173485 /drivers/net | |
parent | 4093785dd16d0b7058eb92331bfd7b40b12151f3 (diff) |
sky2: fix oops on shutdown
If the device is 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: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-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 a307310f13f5..3764008270a2 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -3732,6 +3732,7 @@ err_out_free_regions: | |||
3732 | err_out_disable: | 3732 | err_out_disable: |
3733 | pci_disable_device(pdev); | 3733 | pci_disable_device(pdev); |
3734 | err_out: | 3734 | err_out: |
3735 | pci_set_drvdata(pdev, NULL); | ||
3735 | return err; | 3736 | return err; |
3736 | } | 3737 | } |
3737 | 3738 | ||
@@ -3784,6 +3785,9 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3784 | struct sky2_hw *hw = pci_get_drvdata(pdev); | 3785 | struct sky2_hw *hw = pci_get_drvdata(pdev); |
3785 | int i, wol = 0; | 3786 | int i, wol = 0; |
3786 | 3787 | ||
3788 | if (!hw) | ||
3789 | return 0; | ||
3790 | |||
3787 | del_timer_sync(&hw->idle_timer); | 3791 | del_timer_sync(&hw->idle_timer); |
3788 | netif_poll_disable(hw->dev[0]); | 3792 | netif_poll_disable(hw->dev[0]); |
3789 | 3793 | ||
@@ -3815,6 +3819,9 @@ static int sky2_resume(struct pci_dev *pdev) | |||
3815 | struct sky2_hw *hw = pci_get_drvdata(pdev); | 3819 | struct sky2_hw *hw = pci_get_drvdata(pdev); |
3816 | int i, err; | 3820 | int i, err; |
3817 | 3821 | ||
3822 | if (!hw) | ||
3823 | return 0; | ||
3824 | |||
3818 | err = pci_set_power_state(pdev, PCI_D0); | 3825 | err = pci_set_power_state(pdev, PCI_D0); |
3819 | if (err) | 3826 | if (err) |
3820 | goto out; | 3827 | goto out; |
@@ -3861,6 +3868,9 @@ static void sky2_shutdown(struct pci_dev *pdev) | |||
3861 | struct sky2_hw *hw = pci_get_drvdata(pdev); | 3868 | struct sky2_hw *hw = pci_get_drvdata(pdev); |
3862 | int i, wol = 0; | 3869 | int i, wol = 0; |
3863 | 3870 | ||
3871 | if (!hw) | ||
3872 | return; | ||
3873 | |||
3864 | del_timer_sync(&hw->idle_timer); | 3874 | del_timer_sync(&hw->idle_timer); |
3865 | netif_poll_disable(hw->dev[0]); | 3875 | netif_poll_disable(hw->dev[0]); |
3866 | 3876 | ||