diff options
author | Alexander Usyskin <[email protected]> | 2015-10-26 14:07:58 +0200 |
---|---|---|
committer | Wim Van Sebroeck <[email protected]> | 2015-11-03 14:36:14 +0100 |
commit | 5ef796639c2cacaebc07cf7e63bd20d64f7b3cb0 (patch) | |
tree | f67a860621ae9c2aad11edfad02d70930f692404 | |
parent | bc794ac3b5836ee2b2420b0597f33538ad100be0 (diff) |
watchdog: core: propagate ping error code to the user space
Watchdog ping return errors are ignored by watchdog core,
Whatchdog daemon should be informed about possible hardware error or
underlaying device driver get unregistered.
Signed-off-by: Alexander Usyskin <[email protected]>
Signed-off-by: Tomas Winkler <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Signed-off-by: Wim Van Sebroeck <[email protected]>
-rw-r--r-- | drivers/watchdog/watchdog_dev.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 06171c73daf5..56a649e66eb2 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -294,6 +294,7 @@ static ssize_t watchdog_write(struct file *file, const char __user *data, struct watchdog_device *wdd = file->private_data; size_t i; char c; + int err; if (len == 0) return 0; @@ -313,7 +314,9 @@ static ssize_t watchdog_write(struct file *file, const char __user *data, } /* someone wrote to us, so we send the watchdog a keepalive ping */ - watchdog_ping(wdd); + err = watchdog_ping(wdd); + if (err < 0) + return err; return len; } @@ -369,8 +372,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, case WDIOC_KEEPALIVE: if (!(wdd->info->options & WDIOF_KEEPALIVEPING)) return -EOPNOTSUPP; - watchdog_ping(wdd); - return 0; + return watchdog_ping(wdd); case WDIOC_SETTIMEOUT: if (get_user(val, p)) return -EFAULT; @@ -380,7 +382,9 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, /* If the watchdog is active then we send a keepalive ping * to make sure that the watchdog keep's running (and if * possible that it takes the new timeout) */ - watchdog_ping(wdd); + err = watchdog_ping(wdd); + if (err < 0) + return err; /* Fall */ case WDIOC_GETTIMEOUT: /* timeout == 0 means that we don't know the timeout */ |