From 7ffafd9b6473d229e712bc67e9759042a49483f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Wed, 13 Mar 2024 14:53:54 +0100 Subject: [PATCH] drivers: watchdog: wdt_nrfx.c: Fix error code value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Align driver implementation to the watchdog driver API. https://docs.zephyrproject.org/latest/hardware/peripherals/watchdog.html int wdt_disable(const struct device *dev) shall return: 0 – If successful. -EFAULT – If watchdog instance is not enabled. -EPERM – If watchdog can not be disabled directly by application code. -errno – In case of any other failure. Signed-off-by: Sebastian Głąb --- drivers/watchdog/wdt_nrfx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/wdt_nrfx.c b/drivers/watchdog/wdt_nrfx.c index 5601470b54..57b4dba828 100644 --- a/drivers/watchdog/wdt_nrfx.c +++ b/drivers/watchdog/wdt_nrfx.c @@ -65,7 +65,8 @@ static int wdt_nrf_disable(const struct device *dev) err_code = nrfx_wdt_stop(&config->wdt); if (err_code != NRFX_SUCCESS) { - return -ENOTSUP; + /* This can only happen if wdt_nrf_setup() is not called first. */ + return -EFAULT; } return 0;