summaryrefslogtreecommitdiff
path: root/src/shared/watchdog.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 19:57:32 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 19:57:32 +0100
commit4a62c710b62a5a3c7a8a278b810b9d5b5a0c8f4f (patch)
treec7a6228e7151aa74bc8e331694a1e795226550cd /src/shared/watchdog.c
parent56f64d95763a799ba4475daf44d8e9f72a1bd474 (diff)
treewide: another round of simplifications
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
Diffstat (limited to 'src/shared/watchdog.c')
-rw-r--r--src/shared/watchdog.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c
index 386751418e..2fe4eb81cf 100644
--- a/src/shared/watchdog.c
+++ b/src/shared/watchdog.c
@@ -44,36 +44,28 @@ static int update_timeout(void) {
flags = WDIOS_DISABLECARD;
r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags);
- if (r < 0) {
- log_warning_errno(errno, "Failed to disable hardware watchdog: %m");
- return -errno;
- }
+ if (r < 0)
+ return log_warning_errno(errno, "Failed to disable hardware watchdog: %m");
} else {
int sec, flags;
char buf[FORMAT_TIMESPAN_MAX];
sec = (int) ((watchdog_timeout + USEC_PER_SEC - 1) / USEC_PER_SEC);
r = ioctl(watchdog_fd, WDIOC_SETTIMEOUT, &sec);
- if (r < 0) {
- log_warning_errno(errno, "Failed to set timeout to %is: %m", sec);
- return -errno;
- }
+ if (r < 0)
+ return log_warning_errno(errno, "Failed to set timeout to %is: %m", sec);
watchdog_timeout = (usec_t) sec * USEC_PER_SEC;
log_info("Set hardware watchdog to %s.", format_timespan(buf, sizeof(buf), watchdog_timeout, 0));
flags = WDIOS_ENABLECARD;
r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags);
- if (r < 0) {
- log_warning_errno(errno, "Failed to enable hardware watchdog: %m");
- return -errno;
- }
+ if (r < 0)
+ return log_warning_errno(errno, "Failed to enable hardware watchdog: %m");
r = ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0);
- if (r < 0) {
- log_warning_errno(errno, "Failed to ping hardware watchdog: %m");
- return -errno;
- }
+ if (r < 0)
+ return log_warning_errno(errno, "Failed to ping hardware watchdog: %m");
}
return 0;
@@ -127,10 +119,8 @@ int watchdog_ping(void) {
}
r = ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0);
- if (r < 0) {
- log_warning_errno(errno, "Failed to ping hardware watchdog: %m");
- return -errno;
- }
+ if (r < 0)
+ return log_warning_errno(errno, "Failed to ping hardware watchdog: %m");
return 0;
}