* FAILED: patch "[PATCH] watchdog: npcm: fix clock prepare leak when setting timeout" failed to apply to 6.12-stable tree
@ 2026-11-25 10:15 gregkh
2026-11-25 17:06 ` [PATCH 6.12.y 1/2] watchdog: npcm: Remove unnecessary NULL check before clk_prepare_enable/clk_disable_unprepare Sasha Levin
2026-11-26 3:25 ` [PATCH 6.12.y] " zhaofeng2
0 siblings, 2 replies; 4+ messages in thread
From: gregkh @ 2026-11-25 10:15 UTC (permalink / raw)
To: zhaofeng2, linux; +Cc: stable
The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 57c7cbe21acc77291ec0fbdd4bd72aa259cf4986
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026112521-cartel-refresh-660a@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 57c7cbe21acc77291ec0fbdd4bd72aa259cf4986 Mon Sep 17 00:00:00 2001
From: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
Date: Mon, 9 Nov 2026 15:10:03 +0800
Subject: [PATCH] watchdog: npcm: fix clock prepare leak when setting timeout
on a running watchdog
npcm_wdt_start() unconditionally prepares and enables the watchdog
clock, and npcm_wdt_stop() is the only place that disables it.
npcm_wdt_set_timeout() calls npcm_wdt_start() again whenever the
watchdog is already active, so every WDIOC_SETTIMEOUT ioctl issued
while the watchdog is running takes one extra clock prepare/enable
reference that is never dropped.
Split the register programming out of npcm_wdt_start() into a
__npcm_wdt_start() helper that assumes the clock is already running,
and call the helper from npcm_wdt_set_timeout() instead; only the
watchdog .start callback (and the restart path, which intentionally
keeps the clock) now acquires the clock.
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/20261109071004.1506-1-zhaofeng2@cmss.chinamobile.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
index 4d8f21287144..07ea810fb8c9 100644
--- a/drivers/watchdog/npcm_wdt.c
+++ b/drivers/watchdog/npcm_wdt.c
@@ -145,13 +145,11 @@ static int npcm_wdt_ping(struct watchdog_device *wdd)
return 0;
}
-static int npcm_wdt_start(struct watchdog_device *wdd)
+static void __npcm_wdt_start(struct watchdog_device *wdd)
{
struct npcm_wdt *wdt = to_npcm_wdt(wdd);
u32 val;
- clk_prepare_enable(wdt->clk);
-
if (wdd->timeout < 2)
val = 0x800;
else if (wdd->timeout < 3)
@@ -176,6 +174,15 @@ static int npcm_wdt_start(struct watchdog_device *wdd)
val |= NPCM_WTRE | NPCM_WTE | NPCM_WTR | NPCM_WTIE;
writel(val, wdt->reg);
+}
+
+static int npcm_wdt_start(struct watchdog_device *wdd)
+{
+ struct npcm_wdt *wdt = to_npcm_wdt(wdd);
+
+ clk_prepare_enable(wdt->clk);
+
+ __npcm_wdt_start(wdd);
return 0;
}
@@ -216,7 +223,7 @@ static int npcm_wdt_set_timeout(struct watchdog_device *wdd,
wdd->timeout = 2750;
if (watchdog_active(wdd))
- npcm_wdt_start(wdd);
+ __npcm_wdt_start(wdd);
return 0;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 6.12.y 1/2] watchdog: npcm: Remove unnecessary NULL check before clk_prepare_enable/clk_disable_unprepare
2026-11-25 10:15 FAILED: patch "[PATCH] watchdog: npcm: fix clock prepare leak when setting timeout" failed to apply to 6.12-stable tree gregkh
@ 2026-11-25 17:06 ` Sasha Levin
2026-11-25 17:06 ` [PATCH 6.12.y 2/2] watchdog: npcm: fix clock prepare leak when setting timeout on a running watchdog Sasha Levin
2026-11-26 3:25 ` [PATCH 6.12.y] " zhaofeng2
1 sibling, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2026-11-25 17:06 UTC (permalink / raw)
To: stable; +Cc: Chen Ni, Guenter Roeck, Wim Van Sebroeck, Sasha Levin
From: Chen Ni <nichen@iscas.ac.cn>
[ Upstream commit ad3746700ae238a96a9a4244d02a2e8eb00f157e ]
clk_prepare_enable() and clk_disable_unprepare() already checked
NULL clock parameter.Remove unneeded NULL check for clk here.
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20250313084420.2481763-1-nichen@iscas.ac.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Stable-dep-of: 57c7cbe21acc ("watchdog: npcm: fix clock prepare leak when setting timeout on a running watchdog")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/watchdog/npcm_wdt.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
index a5dd1c2301374..e62ea054bc618 100644
--- a/drivers/watchdog/npcm_wdt.c
+++ b/drivers/watchdog/npcm_wdt.c
@@ -68,8 +68,7 @@ static int npcm_wdt_start(struct watchdog_device *wdd)
struct npcm_wdt *wdt = to_npcm_wdt(wdd);
u32 val;
- if (wdt->clk)
- clk_prepare_enable(wdt->clk);
+ clk_prepare_enable(wdt->clk);
if (wdd->timeout < 2)
val = 0x800;
@@ -105,8 +104,7 @@ static int npcm_wdt_stop(struct watchdog_device *wdd)
writel(0, wdt->reg);
- if (wdt->clk)
- clk_disable_unprepare(wdt->clk);
+ clk_disable_unprepare(wdt->clk);
return 0;
}
@@ -156,8 +154,7 @@ static int npcm_wdt_restart(struct watchdog_device *wdd,
struct npcm_wdt *wdt = to_npcm_wdt(wdd);
/* For reset, we start the WDT clock and leave it running. */
- if (wdt->clk)
- clk_prepare_enable(wdt->clk);
+ clk_prepare_enable(wdt->clk);
writel(NPCM_WTR | NPCM_WTRE | NPCM_WTE, wdt->reg);
udelay(1000);
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 6.12.y 2/2] watchdog: npcm: fix clock prepare leak when setting timeout on a running watchdog
2026-11-25 17:06 ` [PATCH 6.12.y 1/2] watchdog: npcm: Remove unnecessary NULL check before clk_prepare_enable/clk_disable_unprepare Sasha Levin
@ 2026-11-25 17:06 ` Sasha Levin
0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2026-11-25 17:06 UTC (permalink / raw)
To: stable; +Cc: Zhao Feng, Guenter Roeck, Sasha Levin
From: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
[ Upstream commit 57c7cbe21acc77291ec0fbdd4bd72aa259cf4986 ]
npcm_wdt_start() unconditionally prepares and enables the watchdog
clock, and npcm_wdt_stop() is the only place that disables it.
npcm_wdt_set_timeout() calls npcm_wdt_start() again whenever the
watchdog is already active, so every WDIOC_SETTIMEOUT ioctl issued
while the watchdog is running takes one extra clock prepare/enable
reference that is never dropped.
Split the register programming out of npcm_wdt_start() into a
__npcm_wdt_start() helper that assumes the clock is already running,
and call the helper from npcm_wdt_set_timeout() instead; only the
watchdog .start callback (and the restart path, which intentionally
keeps the clock) now acquires the clock.
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/20261109071004.1506-1-zhaofeng2@cmss.chinamobile.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/watchdog/npcm_wdt.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
index e62ea054bc618..aff1ea1e6b62d 100644
--- a/drivers/watchdog/npcm_wdt.c
+++ b/drivers/watchdog/npcm_wdt.c
@@ -63,13 +63,11 @@ static int npcm_wdt_ping(struct watchdog_device *wdd)
return 0;
}
-static int npcm_wdt_start(struct watchdog_device *wdd)
+static void __npcm_wdt_start(struct watchdog_device *wdd)
{
struct npcm_wdt *wdt = to_npcm_wdt(wdd);
u32 val;
- clk_prepare_enable(wdt->clk);
-
if (wdd->timeout < 2)
val = 0x800;
else if (wdd->timeout < 3)
@@ -94,6 +92,15 @@ static int npcm_wdt_start(struct watchdog_device *wdd)
val |= NPCM_WTRE | NPCM_WTE | NPCM_WTR | NPCM_WTIE;
writel(val, wdt->reg);
+}
+
+static int npcm_wdt_start(struct watchdog_device *wdd)
+{
+ struct npcm_wdt *wdt = to_npcm_wdt(wdd);
+
+ clk_prepare_enable(wdt->clk);
+
+ __npcm_wdt_start(wdd);
return 0;
}
@@ -134,7 +141,7 @@ static int npcm_wdt_set_timeout(struct watchdog_device *wdd,
wdd->timeout = 2750;
if (watchdog_active(wdd))
- npcm_wdt_start(wdd);
+ __npcm_wdt_start(wdd);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 6.12.y] watchdog: npcm: fix clock prepare leak when setting timeout on a running watchdog
2026-11-25 10:15 FAILED: patch "[PATCH] watchdog: npcm: fix clock prepare leak when setting timeout" failed to apply to 6.12-stable tree gregkh
2026-11-25 17:06 ` [PATCH 6.12.y 1/2] watchdog: npcm: Remove unnecessary NULL check before clk_prepare_enable/clk_disable_unprepare Sasha Levin
@ 2026-11-26 3:25 ` zhaofeng2
1 sibling, 0 replies; 4+ messages in thread
From: zhaofeng2 @ 2026-11-26 3:25 UTC (permalink / raw)
To: stable; +Cc: Zhao Feng, Guenter Roeck
From: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
commit 57c7cbe21acc77291ec0fbdd4bd72aa259cf4986 upstream.
npcm_wdt_start() unconditionally prepares and enables the watchdog
clock, and npcm_wdt_stop() is the only place that disables it.
npcm_wdt_set_timeout() calls npcm_wdt_start() again whenever the
watchdog is already active, so every WDIOC_SETTIMEOUT ioctl issued
while the watchdog is running takes one extra clock prepare/enable
reference that is never dropped.
Split the register programming out of npcm_wdt_start() into a
__npcm_wdt_start() helper that assumes the clock is already running,
and call the helper from npcm_wdt_set_timeout() instead; only the
watchdog .start callback (and the restart path, which intentionally
keeps the clock) now acquires the clock.
Fixes: af084fdccfaf ("watchdog: npcm: Enable clock if provided")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
6.12.y backport: 6.12 retains the `if (wdt->clk)` NULL check which
upstream removed before this fix. The backport keeps the NULL check
in the new npcm_wdt_start() wrapper and is otherwise identical.
drivers/watchdog/npcm_wdt.c | 24 ++++++++++++++++++++-----
1 file changed, 17 insertions(+), 3 deletions(-)
--- a/drivers/watchdog/npcm_wdt.c
+++ b/drivers/watchdog/npcm_wdt.c
@@ -63,13 +63,10 @@
return 0;
}
-static int npcm_wdt_start(struct watchdog_device *wdd)
+static void __npcm_wdt_start(struct watchdog_device *wdd)
{
struct npcm_wdt *wdt = to_npcm_wdt(wdd);
u32 val;
-
- if (wdt->clk)
- clk_prepare_enable(wdt->clk);
if (wdd->timeout < 2)
val = 0x800;
@@ -95,6 +92,16 @@
val |= NPCM_WTRE | NPCM_WTE | NPCM_WTR | NPCM_WTIE;
writel(val, wdt->reg);
+}
+
+static int npcm_wdt_start(struct watchdog_device *wdd)
+{
+ struct npcm_wdt *wdt = to_npcm_wdt(wdd);
+
+ if (wdt->clk)
+ clk_prepare_enable(wdt->clk);
+
+ __npcm_wdt_start(wdd);
return 0;
}
@@ -136,7 +143,7 @@
wdd->timeout = 2750;
if (watchdog_active(wdd))
- npcm_wdt_start(wdd);
+ __npcm_wdt_start(wdd);
return 0;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-26 3:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 10:15 FAILED: patch "[PATCH] watchdog: npcm: fix clock prepare leak when setting timeout" failed to apply to 6.12-stable tree gregkh
2026-11-25 17:06 ` [PATCH 6.12.y 1/2] watchdog: npcm: Remove unnecessary NULL check before clk_prepare_enable/clk_disable_unprepare Sasha Levin
2026-11-25 17:06 ` [PATCH 6.12.y 2/2] watchdog: npcm: fix clock prepare leak when setting timeout on a running watchdog Sasha Levin
2026-11-26 3:25 ` [PATCH 6.12.y] " zhaofeng2
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox