From 5a8a95ed7779e8dea703a79b10a6f54a8ddbba2c Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Sat, 11 Oct 2003 20:17:44 +0200 Subject: [PATCH] Fix a crash on sleep in the OF platform core where we would use a NULL "driver" pointer and actually try to call it after casting it ! --- arch/ppc/syslib/of_device.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/ppc/syslib/of_device.c b/arch/ppc/syslib/of_device.c index a8c2715bf78f8..b27a75f1b986e 100644 --- a/arch/ppc/syslib/of_device.c +++ b/arch/ppc/syslib/of_device.c @@ -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; } -- 2.53.0