drivers/watchdog/watchdog_dev.c | 4 ++++ 1 file changed, 4 insertions(+)
Presently, when a watchdog device is closed, we print "watchdog did not
stop" in a few different scenarios;
1. When nowayout is set
2. When the watchdog is able to close, has received the magic character
to stop, but fails to close in device-specific code paths
3. When userspace deliberately closes it without stopping it
For 1, we explicitly print we can not close because of nowayout. Nothing
differentiates the other two however.
This change adds a print to indicate the watchdog was closed while still
running.
Suggested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Charles Haithcock <chaithco@redhat.com>
---
v1. Introduce change and modify logic to differentiate
v2. Simplify but still differentiate
drivers/watchdog/watchdog_dev.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index d7895009a2..937bdd4c92 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -305,6 +305,10 @@ static int watchdog_stop(struct watchdog_device *wdd)
if (wdd->ops->stop) {
clear_bit(WDOG_HW_RUNNING, &wdd->status);
err = wdd->ops->stop(wdd);
+ if (err < 0) {
+ pr_err("watchdog%d: Failed to stop watchdog: %pe\n", wdd->id,
+ ERR_PTR(err));
+ }
trace_watchdog_stop(wdd, err);
} else {
set_bit(WDOG_HW_RUNNING, &wdd->status);
--
2.55.0
On Tue, Sep 01, 2026 at 03:42:49PM -0600, Charles Haithcock wrote:
> Presently, when a watchdog device is closed, we print "watchdog did not
> stop" in a few different scenarios;
>
> 1. When nowayout is set
> 2. When the watchdog is able to close, has received the magic character
> to stop, but fails to close in device-specific code paths
> 3. When userspace deliberately closes it without stopping it
>
> For 1, we explicitly print we can not close because of nowayout. Nothing
> differentiates the other two however.
>
> This change adds a print to indicate the watchdog was closed while still
> running.
>
> Suggested-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Charles Haithcock <chaithco@redhat.com>
Applied, but please version your patches in the future.
Thanks,
Guenter
> ---
>
> v1. Introduce change and modify logic to differentiate
> v2. Simplify but still differentiate
>
> drivers/watchdog/watchdog_dev.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
> index d7895009a2..937bdd4c92 100644
> --- a/drivers/watchdog/watchdog_dev.c
> +++ b/drivers/watchdog/watchdog_dev.c
> @@ -305,6 +305,10 @@ static int watchdog_stop(struct watchdog_device *wdd)
> if (wdd->ops->stop) {
> clear_bit(WDOG_HW_RUNNING, &wdd->status);
> err = wdd->ops->stop(wdd);
> + if (err < 0) {
> + pr_err("watchdog%d: Failed to stop watchdog: %pe\n", wdd->id,
> + ERR_PTR(err));
> + }
> trace_watchdog_stop(wdd, err);
> } else {
> set_bit(WDOG_HW_RUNNING, &wdd->status);
On Tue, 2026-09-01 at 16:02 -0700, Guenter Roeck wrote: > > Applied, but please version your patches in the future. > Ah thank you so much for the feedback! I am a fair bit newer to contributing upstream; I presumed (erroneously) adding the versioning after --- was sufficient. I will make sure to add the version number to the commit message in the future as well!
© 2016 - 2026 Red Hat, Inc.