summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/allocator
diff options
context:
space:
mode:
authorZhao Feng <zhaofeng2@cmss.chinamobile.com>2026-11-11 16:32:36 +0800
committerGuenter Roeck <linux@roeck-us.net>2026-11-15 14:42:47 -0800
commit4e83ea5b22193fd0db8bcee5682935f1d528705e (patch)
tree4fa21a1264b4a6533256a085deaef242cd624c59 /rust/kernel/alloc/allocator
parentaebb7274476403040d582c61478df8f4a7bf9cd3 (diff)
watchdog: npcm: fix sleeping clock call in restart handler
The watchdog .restart callback runs in atomic context: it is invoked from the restart handler chain via atomic_notifier_call_chain(), under an RCU read-side critical section, on every reboot or restart. Since commit af084fdccfaf ("watchdog: npcm: Enable clock if provided"), npcm_wdt_restart() calls clk_prepare_enable(), and clk_prepare() takes a mutex unconditionally, so kernels built with CONFIG_DEBUG_ATOMIC_SLEEP=y report BUG: sleeping function called from invalid context on every reboot. Worse, a panic-time restart can block on prepare_lock and never issue the reset at all. Get the clock with devm_clk_get_optional_prepared() at probe time and keep it prepared for the lifetime of the driver, so the restart handler only needs clk_enable(), which is safe in atomic context. With the clock permanently prepared, npcm_wdt_start() and npcm_wdt_stop() are simplified to clk_enable()/clk_disable() as well. Fixes: af084fdccfaf ("watchdog: npcm: Enable clock if provided") Cc: stable@vger.kernel.org Signed-off-by: Zhao Feng <zhaofeng2@cmss.chinamobile.com> Link: https://patch.msgid.link/20261111083236.248-1-zhaofeng2@cmss.chinamobile.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'rust/kernel/alloc/allocator')
0 files changed, 0 insertions, 0 deletions