Fix 3.3 merge error in: drivers: power: Add watchdog timer to catch drivers which...
Arve Hjønnevåg [Wed, 21 Mar 2012 23:43:45 +0000 (16:43 -0700)]
__device_suspend could return with an active timer on the stack

Change-Id: I113f5f9aa12f909cb46621b6744e02a104ddd2bd
Signed-off-by: Arve Hjønnevåg <arve@android.com>

drivers/base/power/main.c

index b8071e8..95d2f17 100644 (file)
@@ -1053,14 +1053,6 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
 
        dpm_wait_for_children(dev, async);
 
-       data.dev = dev;
-       data.tsk = get_current();
-       init_timer_on_stack(&timer);
-       timer.expires = jiffies + HZ * 12;
-       timer.function = dpm_drv_timeout;
-       timer.data = (unsigned long)&data;
-       add_timer(&timer);
-
        if (async_error)
                return 0;
 
@@ -1074,6 +1066,14 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
                return 0;
        }
 
+       data.dev = dev;
+       data.tsk = get_current();
+       init_timer_on_stack(&timer);
+       timer.expires = jiffies + HZ * 12;
+       timer.function = dpm_drv_timeout;
+       timer.data = (unsigned long)&data;
+       add_timer(&timer);
+
        device_lock(dev);
 
        if (dev->pm_domain) {