Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>

authored by

Alexander Usyskin and committed by
Wim Van Sebroeck
5ef79663 bc794ac3

+8 -4
+8 -4
drivers/watchdog/watchdog_dev.c
··· 294 294 struct watchdog_device *wdd = file->private_data; 295 295 size_t i; 296 296 char c; 297 + int err; 297 298 298 299 if (len == 0) 299 300 return 0; ··· 314 313 } 315 314 316 315 /* someone wrote to us, so we send the watchdog a keepalive ping */ 317 - watchdog_ping(wdd); 316 + err = watchdog_ping(wdd); 317 + if (err < 0) 318 + return err; 318 319 319 320 return len; 320 321 } ··· 372 369 case WDIOC_KEEPALIVE: 373 370 if (!(wdd->info->options & WDIOF_KEEPALIVEPING)) 374 371 return -EOPNOTSUPP; 375 - watchdog_ping(wdd); 376 - return 0; 372 + return watchdog_ping(wdd); 377 373 case WDIOC_SETTIMEOUT: 378 374 if (get_user(val, p)) 379 375 return -EFAULT; ··· 382 380 /* If the watchdog is active then we send a keepalive ping 383 381 * to make sure that the watchdog keep's running (and if 384 382 * possible that it takes the new timeout) */ 385 - watchdog_ping(wdd); 383 + err = watchdog_ping(wdd); 384 + if (err < 0) 385 + return err; 386 386 /* Fall */ 387 387 case WDIOC_GETTIMEOUT: 388 388 /* timeout == 0 means that we don't know the timeout */