]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
watchdog: minor simplification of watchdog_runtime_wait()
authorFranck Bui <fbui@suse.com>
Mon, 6 Sep 2021 12:31:30 +0000 (14:31 +0200)
committerFranck Bui <fbui@suse.com>
Wed, 15 Sep 2021 09:32:21 +0000 (11:32 +0200)
No functional change.

src/shared/watchdog.c

index 98532dbcb47d4f78ffe98d7913149f9791954530..b0b377325ce8daeba0accd4b0b041f78e37b9201 100644 (file)
@@ -120,20 +120,19 @@ int watchdog_set_timeout(usec_t timeout) {
 }
 
 usec_t watchdog_runtime_wait(void) {
-        usec_t rtwait, ntime;
 
         if (!timestamp_is_set(watchdog_timeout))
                 return USEC_INFINITY;
 
         /* Sleep half the watchdog timeout since the last successful ping at most */
         if (timestamp_is_set(watchdog_last_ping)) {
-                ntime = now(clock_boottime_or_monotonic());
+                usec_t ntime = now(clock_boottime_or_monotonic());
+
                 assert(ntime >= watchdog_last_ping);
-                rtwait = usec_sub_unsigned(watchdog_last_ping + (watchdog_timeout / 2), ntime);
-        } else
-                rtwait = watchdog_timeout / 2;
+                return usec_sub_unsigned(watchdog_last_ping + (watchdog_timeout / 2), ntime);
+        }
 
-        return rtwait;
+        return watchdog_timeout / 2;
 }
 
 int watchdog_ping(void) {