From fcbf2c64f5c392f4bbf820b446d0b6f993527b62 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Fri, 17 Sep 2021 09:21:18 +0200 Subject: [PATCH] watchdog: minor optimization in watchdog_setup() --- src/shared/watchdog.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c index 78c13a7b05..3f4effddb5 100644 --- a/src/shared/watchdog.c +++ b/src/shared/watchdog.c @@ -134,6 +134,10 @@ int watchdog_set_device(const char *path) { int watchdog_setup(usec_t timeout) { + /* Let's shortcut duplicated requests */ + if (watchdog_fd >= 0 && watchdog_timeout == timeout) + 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 */ -- 2.25.1