]> git.hungrycats.org Git - linux/commitdiff
Fix a crash on sleep in the OF platform core where we would
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Sat, 11 Oct 2003 18:17:44 +0000 (20:17 +0200)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Sat, 11 Oct 2003 18:17:44 +0000 (20:17 +0200)
use a NULL "driver" pointer and actually try to call it after
casting it !

arch/ppc/syslib/of_device.c

index a8c2715bf78f810b46a3c77f5d3932d95486fa77..b27a75f1b986e529934c40ab98279164ab94e08f 100644 (file)
@@ -97,9 +97,9 @@ static int of_device_probe(struct device *dev)
 static int of_device_remove(struct device *dev)
 {
        struct of_device * of_dev = to_of_device(dev);
-       struct of_platform_driver * drv = to_of_platform_driver(of_dev->dev.driver);
+       struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
 
-       if (drv && drv->remove)
+       if (dev->driver && drv->remove)
                drv->remove(of_dev);
        return 0;
 }
@@ -107,10 +107,10 @@ static int of_device_remove(struct device *dev)
 static int of_device_suspend(struct device *dev, u32 state)
 {
        struct of_device * of_dev = to_of_device(dev);
-       struct of_platform_driver * drv = to_of_platform_driver(of_dev->dev.driver);
+       struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
        int error = 0;
 
-       if (drv && drv->suspend)
+       if (dev->driver && drv->suspend)
                error = drv->suspend(of_dev, state);
        return error;
 }
@@ -118,10 +118,10 @@ static int of_device_suspend(struct device *dev, u32 state)
 static int of_device_resume(struct device * dev)
 {
        struct of_device * of_dev = to_of_device(dev);
-       struct of_platform_driver * drv = to_of_platform_driver(of_dev->dev.driver);
+       struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
        int error = 0;
 
-       if (drv && drv->resume)
+       if (dev->driver && drv->resume)
                error = drv->resume(of_dev);
        return error;
 }