Message ID | 1401261818-2978-2-git-send-email-rui.zhang@intel.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index 2d56f41..030b069 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -318,10 +318,15 @@ int device_init_wakeup(struct device *dev, bool enable) { int ret = 0; + if (!dev) + return -EINVAL; + if (enable) { device_set_wakeup_capable(dev, true); ret = device_wakeup_enable(dev); } else { + if (dev->power.can_wakeup) + device_wakeup_disable(dev); device_set_wakeup_capable(dev, false); }
When enabling a device' wakeup capability, a wakeup source is created for the device automatically. But the wakeup source is not unregistered when disabling the device' wakeup capability. This results in zombie wakeup sources, after devices/drivers are unregistered. Signed-off-by: Zhang Rui <rui.zhang@intel.com> --- drivers/base/power/wakeup.c | 5 +++++ 1 file changed, 5 insertions(+)