]> git.baikalelectronics.ru Git - kernel.git/commit
PM / wakeirq: Avoid setting power.wakeirq too hastily
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 7 Jul 2015 11:08:39 +0000 (13:08 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 7 Jul 2015 11:08:39 +0000 (13:08 +0200)
commit070b93cd93975b955babac66a4fa1f2a617d4695
treec6f73c97ea97931bbb8cf4d36e8c2e7b0d321268
parentaa5190357a025efe687cebe6e94427414391f3f9
PM / wakeirq: Avoid setting power.wakeirq too hastily

If dev_pm_attach_wake_irq() fails, the device's power.wakeirq field
should not be set to point to the struct wake_irq passed to that
function, as that object will be freed going forward.

For this reason, make dev_pm_attach_wake_irq() first call
device_wakeup_attach_irq() and only set the device's power.wakeirq
field if that's successful.

That requires device_wakeup_attach_irq() to be called under the
device's power.lock lock, but since dev_pm_attach_wake_irq() is
the only caller of it, the requisite changes are easy to make.

Fixes: a8ec057d01b2 (PM / Wakeirq: Add automated device wake IRQ handling)
Reported-by: Felipe Balbi <balbi@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/wakeirq.c
drivers/base/power/wakeup.c