]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
skge: crash on shutdown/suspend
authorStephen Hemminger <shemminger@linux-foundation.org>
Fri, 11 May 2007 18:21:45 +0000 (11:21 -0700)
committerJeff Garzik <jeff@garzik.org>
Fri, 11 May 2007 21:53:36 +0000 (17:53 -0400)
If device is not fails during module startup (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: Jeff Garzik <jeff@garzik.org>
drivers/net/skge.c

index e0489578945dccda63d486d83e1d55b5228a2753..776692946562090527838259d780db424b9afc11 100644 (file)
@@ -3802,6 +3802,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;
@@ -3830,6 +3833,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;
@@ -3868,6 +3874,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);