PM / Runtime: Ensure timer_expires is nonzero in pm_schedule_suspend()
authorRafael J. Wysocki <rjw@sisk.pl>
Thu, 3 Dec 2009 20:03:57 +0000 (21:03 +0100)
committerRafael J. Wysocki <rjw@sisk.pl>
Sun, 6 Dec 2009 15:17:56 +0000 (16:17 +0100)
The runtime PM core code assumes that dev->power.timer_expires is
nonzero when the timer is scheduled, but it may become zero
incidentally in pm_schedule_suspend().  Prevent this from happening
by bumping dev->power.timer_expires up to 1 if it's 0 before calling
mod_timer().

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-by: Alan Stern <stern@rowland.harvard.edu>
drivers/base/power/runtime.c

index 6e8577d1f750844df0bf194863a4e00a1b9b41dd..6377069518854a726a2e3b24ae4ad6e4f769b8d3 100644 (file)
@@ -625,6 +625,8 @@ int pm_schedule_suspend(struct device *dev, unsigned int delay)
                goto out;
 
        dev->power.timer_expires = jiffies + msecs_to_jiffies(delay);
+       if (!dev->power.timer_expires)
+               dev->power.timer_expires = 1;
        mod_timer(&dev->power.suspend_timer, dev->power.timer_expires);
 
  out: