From e22f2aa1671159b2a5dfc276f2bd913aa3e1022e Mon Sep 17 00:00:00 2001 From: Oleksij Rempel Date: Tue, 13 Mar 2018 09:33:26 +0100 Subject: watchdog: set some reasonable timeout_max value if no other is available Some drivers do not provide timeout_max value. Using some value is probably better then setting timeout_max to 0. Signed-off-by: Oleksij Rempel Signed-off-by: Sascha Hauer --- drivers/watchdog/wd_core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'drivers/watchdog') diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c index 6f9c2707a7..845234114d 100644 --- a/drivers/watchdog/wd_core.c +++ b/drivers/watchdog/wd_core.c @@ -59,8 +59,14 @@ int watchdog_register(struct watchdog *wd) if (!wd->priority) wd->priority = WATCHDOG_DEFAULT_PRIORITY; - dev_add_param_uint32_ro(&wd->dev, "timeout_max", + /* set some default sane value */ + if (!wd->timeout_max) + wd->timeout_max = 60 * 60 * 24; + + p = dev_add_param_uint32_ro(&wd->dev, "timeout_max", &wd->timeout_max, "%u"); + if (IS_ERR(p)) + return PTR_ERR(p); list_add_tail(&wd->list, &watchdog_list); -- cgit v1.2.3