From: Franck Bui Date: Fri, 17 Sep 2021 07:21:18 +0000 (+0200) Subject: watchdog: minor optimization in watchdog_setup() X-Git-Tag: v250-rc1~510^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fcbf2c64f5c392f4bbf820b446d0b6f993527b62;p=thirdparty%2Fsystemd.git watchdog: minor optimization in watchdog_setup() --- diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c index 78c13a7b059..3f4effddb51 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 */