From 8ce08c8e97e7fbeed39c6293a72ec411b401b300 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Fri, 7 Jan 2022 09:28:44 +0100 Subject: [PATCH 1/3] watchdog: shorten watchdog_set_device() --- src/shared/watchdog.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c index ed2998f46c..ba5a7e26dd 100644 --- a/src/shared/watchdog.c +++ b/src/shared/watchdog.c @@ -156,9 +156,6 @@ int watchdog_set_device(const char *path) { int r; r = free_and_strdup(&watchdog_device, path); - if (r < 0) - return r; - if (r > 0) /* watchdog_device changed */ watchdog_fd = safe_close(watchdog_fd); From b144177240bf31a6d862df20182b16c48df4930a Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 6 Jan 2022 21:11:21 +0900 Subject: [PATCH 2/3] watchdog: rebreak comments --- src/shared/watchdog.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c index ba5a7e26dd..e8184ff661 100644 --- a/src/shared/watchdog.c +++ b/src/shared/watchdog.c @@ -166,11 +166,9 @@ int watchdog_setup(usec_t timeout) { usec_t previous_timeout; int r; - /* timeout=0 closes the device whereas passing timeout=USEC_INFINITY - * opens it (if needed) without configuring any particular timeout and - * thus reuses the programmed value (therefore it's a nop if the device - * is already opened). - */ + /* timeout=0 closes the device whereas passing timeout=USEC_INFINITY opens it (if needed) + * without configuring any particular timeout and thus reuses the programmed value (therefore + * it's a nop if the device is already opened). */ if (timeout == 0) { watchdog_close(true); @@ -181,9 +179,8 @@ int watchdog_setup(usec_t timeout) { if (watchdog_fd >= 0 && (timeout == watchdog_timeout || timeout == USEC_INFINITY)) return 0; - /* Initialize the watchdog timeout with the caller value. This value is - * going to be updated by update_timeout() with the closest value - * supported by the driver */ + /* Initialize the watchdog timeout with the caller value. This value is going to be updated by + * update_timeout() with the closest value supported by the driver */ previous_timeout = watchdog_timeout; watchdog_timeout = timeout; From aac470326ebceb97af7c2070da82decf93f21503 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 6 Jan 2022 21:21:41 +0900 Subject: [PATCH 3/3] pid1: voidify manager_override_watchdog() As it always returns 0. --- src/core/dbus-manager.c | 3 ++- src/core/manager.c | 7 +++---- src/core/manager.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 9b64a8074d..8dbb61eb05 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -314,7 +314,8 @@ static int property_set_watchdog(Manager *m, WatchdogType type, sd_bus_message * if (r < 0) return r; - return manager_override_watchdog(m, type, timeout); + manager_override_watchdog(m, type, timeout); + return 0; } static int property_set_runtime_watchdog( diff --git a/src/core/manager.c b/src/core/manager.c index 12c49e7fca..8841be4a72 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -3239,15 +3239,15 @@ void manager_set_watchdog(Manager *m, WatchdogType t, usec_t timeout) { m->watchdog[t] = timeout; } -int manager_override_watchdog(Manager *m, WatchdogType t, usec_t timeout) { +void manager_override_watchdog(Manager *m, WatchdogType t, usec_t timeout) { assert(m); if (MANAGER_IS_USER(m)) - return 0; + return; if (m->watchdog_overridden[t] == timeout) - return 0; + return; if (t == WATCHDOG_RUNTIME) { usec_t usec = timestamp_is_set(timeout) ? timeout : m->watchdog[t]; @@ -3256,7 +3256,6 @@ int manager_override_watchdog(Manager *m, WatchdogType t, usec_t timeout) { } m->watchdog_overridden[t] = timeout; - return 0; } int manager_reload(Manager *m) { diff --git a/src/core/manager.h b/src/core/manager.h index e445e4d751..8f9984aa51 100644 --- a/src/core/manager.h +++ b/src/core/manager.h @@ -573,7 +573,7 @@ ManagerTimestamp manager_timestamp_initrd_mangle(ManagerTimestamp s); usec_t manager_get_watchdog(Manager *m, WatchdogType t); void manager_set_watchdog(Manager *m, WatchdogType t, usec_t timeout); -int manager_override_watchdog(Manager *m, WatchdogType t, usec_t timeout); +void manager_override_watchdog(Manager *m, WatchdogType t, usec_t timeout); const char* oom_policy_to_string(OOMPolicy i) _const_; OOMPolicy oom_policy_from_string(const char *s) _pure_;