From: Rafael J. Wysocki Date: Thu, 3 Dec 2009 20:03:57 +0000 (+0100) Subject: PM / Runtime: Ensure timer_expires is nonzero in pm_schedule_suspend() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0ddf0ed1d47e2d4170fa2989273886a1df66a862;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Reported-by: Alan Stern --- 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) 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: