aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-05-15 15:08:26 -0700
committerChris Wright <chrisw@sous-sol.org>2007-05-23 14:32:53 -0700
commit71609984a43bab184a8f47eb34b15704cb7c0485 (patch)
tree03a27482638c3b67bf0cc160513d71e0d0912955 /drivers
parentaba5b093486f76219c57a4603b1feed97eaba462 (diff)
[PATCH] skge: crash on shutdown/suspend
If device fails during module startup for some reason (like unsupported chip version) then 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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/skge.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 74c19c529d0..5ef902390c6 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -3794,6 +3794,9 @@ static int skge_suspend(struct pci_dev *pdev, pm_message_t state)
struct skge_hw *hw = pci_get_drvdata(pdev);
int i, err, wol = 0;
+ if (!hw)
+ return 0;
+
err = pci_save_state(pdev);
if (err)
return err;
@@ -3822,6 +3825,9 @@ static int skge_resume(struct pci_dev *pdev)
struct skge_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;
@@ -3860,6 +3866,9 @@ static void skge_shutdown(struct pci_dev *pdev)
struct skge_hw *hw = pci_get_drvdata(pdev);
int i, wol = 0;
+ if (!hw)
+ return;
+
for (i = 0; i < hw->ports; i++) {
struct net_device *dev = hw->dev[i];
struct skge_port *skge = netdev_priv(dev);