Skip to content

Commit

Permalink
PM / Runtime: Ensure timer_expires is nonzero in pm_schedule_suspend()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rafael J. Wysocki committed Dec 6, 2009
1 parent 63c9480 commit 0ddf0ed
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/base/power/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0ddf0ed

Please sign in to comment.