summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/wd_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog/wd_core.c')
-rw-r--r--drivers/watchdog/wd_core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
index de1f4c7327..6f9c2707a7 100644
--- a/drivers/watchdog/wd_core.c
+++ b/drivers/watchdog/wd_core.c
@@ -59,6 +59,9 @@ int watchdog_register(struct watchdog *wd)
if (!wd->priority)
wd->priority = WATCHDOG_DEFAULT_PRIORITY;
+ dev_add_param_uint32_ro(&wd->dev, "timeout_max",
+ &wd->timeout_max, "%u");
+
list_add_tail(&wd->list, &watchdog_list);
pr_debug("registering watchdog %s with priority %d\n", watchdog_name(wd),
@@ -105,6 +108,9 @@ int watchdog_set_timeout(unsigned timeout)
if (!wd)
return -ENODEV;
+ if (timeout > wd->timeout_max)
+ return -EINVAL;
+
pr_debug("setting timeout on %s to %ds\n", watchdog_name(wd), timeout);
return wd->set_timeout(wd, timeout);