[PATCH] watchdog: Enforce that at least one pretimeout governor is enabled

From: Guenter Roeck
Date: Tue May 07 2019 - 20:44:05 EST


Since commit "watchdog: Use depends instead of select for pretimeout
governors", it was possible to enable pretimeout governors but keep all
of them disabled. Doing this results in the following build failure.

../drivers/watchdog/watchdog_pretimeout.c:
In function âwatchdog_register_governorâ:
../drivers/watchdog/watchdog_pretimeout.c:139:26: error:
âWATCHDOG_PRETIMEOUT_DEFAULT_GOVâ undeclared
if (!strncmp(gov->name, WATCHDOG_PRETIMEOUT_DEFAULT_GOV,

Since it does not make sense to enable pretimeout support but disable
all pretimeout governors, enforce that at least one of them is always
enabled.

Fixes: f627ac0e12cd ("watchdog: Use depends instead of select for pretimeout governors")
Reported-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
---
Fixes: sha is from next-20190507.

drivers/watchdog/Kconfig | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index e19960ace0c0..4a3461afa96f 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -71,6 +71,12 @@ config WATCHDOG_PRETIMEOUT_GOV
help
The option allows to select watchdog pretimeout governors.

+config WATCHDOG_PRETIMEOUT_GOV_SEL
+ tristate
+ depends on WATCHDOG_PRETIMEOUT_GOV
+ default m
+ select WATCHDOG_PRETIMEOUT_GOV_PANIC if WATCHDOG_PRETIMEOUT_GOV_NOOP=n
+
if WATCHDOG_PRETIMEOUT_GOV

config WATCHDOG_PRETIMEOUT_GOV_NOOP
--
2.7.4