diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2009-12-03 15:03:57 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2009-12-06 10:17:56 -0500 |
commit | 0ddf0ed1d47e2d4170fa2989273886a1df66a862 (patch) | |
tree | 179d0f0de4ef726209c068ea9616f5ccd6a73173 | |
parent | 63c94801701abfea21570d3302687ec027ed33e8 (diff) |
PM / Runtime: Ensure timer_expires is nonzero in pm_schedule_suspend()
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>
-rw-r--r-- | drivers/base/power/runtime.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 6e8577d1f750..637706951885 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -625,6 +625,8 @@ int pm_schedule_suspend(struct device *dev, unsigned int delay) | |||
625 | goto out; | 625 | goto out; |
626 | 626 | ||
627 | dev->power.timer_expires = jiffies + msecs_to_jiffies(delay); | 627 | dev->power.timer_expires = jiffies + msecs_to_jiffies(delay); |
628 | if (!dev->power.timer_expires) | ||
629 | dev->power.timer_expires = 1; | ||
628 | mod_timer(&dev->power.suspend_timer, dev->power.timer_expires); | 630 | mod_timer(&dev->power.suspend_timer, dev->power.timer_expires); |
629 | 631 | ||
630 | out: | 632 | out: |