]> git.baikalelectronics.ru Git - kernel.git/commit
alarmtimer: Unregister wakeup source when module get fails
authorStephen Boyd <swboyd@chromium.org>
Thu, 9 Jan 2020 15:59:07 +0000 (07:59 -0800)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 15 Jan 2020 10:16:54 +0000 (11:16 +0100)
commit53f2188b18a116a84c6553681eeffc6ccbf25e1c
tree12fe809c25800e4109df5f9f13456c61e8279419
parent83d7ca2ce1077db7445c668c4045b79b96b0bb63
alarmtimer: Unregister wakeup source when module get fails

The alarmtimer_rtc_add_device() function creates a wakeup source and then
tries to grab a module reference. If that fails the function returns early
with an error code, but fails to remove the wakeup source.

Cleanup this exit path so there is no dangling wakeup source, which is
named 'alarmtime' left allocated which will conflict with another RTC
device that may be registered later.

Fixes: ee5775065e55 ("alarmtimer: Ensure RTC module is not unloaded")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200109155910.907-2-swboyd@chromium.org
kernel/time/alarmtimer.c