summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSurendra Singh Chouhan <kr494167@gmail.com>2026-07-23 07:56:34 +0530
committerGuenter Roeck <linux@roeck-us.net>2026-07-27 15:08:15 -0700
commit8d2b10eef6f3b1336be2d1197db29b0c697f1d41 (patch)
treefa0d3a673531aab12eddb70cbaed7bb4d299f05a
parentf5098b6bae761e346ebcd9da7f95622c04733cff (diff)
downloadlinux-next-8d2b10eef6f3b1336be2d1197db29b0c697f1d41.tar.gz
linux-next-8d2b10eef6f3b1336be2d1197db29b0c697f1d41.zip
watchdog: atcwdt200: fix return value when watchdog is enabled
atcwdt_get_int_timer_type() returned TMR_UNKNOWN (enum value 3) when CTRL_WDT_EN was set in the control register. Because atcwdt_probe() checks "ret = atcwdt_get_int_timer_type(drv_data); if (ret) return ret;", returning TMR_UNKNOWN caused probe() to return 3 instead of a valid negative error code. Fix this by returning -EBUSY via dev_err_probe() when the watchdog is already enabled and update the kernel-doc description accordingly. Fixes: e4e0848ad046 ("watchdog: atcwdt200: Add driver for Andes ATCWDT200") Signed-off-by: Surendra Singh Chouhan <kr494167@gmail.com> Link: https://lore.kernel.org/r/20260723022634.8642-1-kr494167@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/watchdog/atcwdt200_wdt.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/watchdog/atcwdt200_wdt.c b/drivers/watchdog/atcwdt200_wdt.c
index 8e3b18aea368..7e757c217b0b 100644
--- a/drivers/watchdog/atcwdt200_wdt.c
+++ b/drivers/watchdog/atcwdt200_wdt.c
@@ -260,9 +260,9 @@ static void atcwdt_get_timeout_params(struct atcwdt_drv *drv_data,
* register to determine the interrupt timer type supported by the hardware.
*
* Note: This function must only be called when the ATCWDT200 watchdog is
- * disabled. If the watchdog is enabled, this function returns TMR_UNKNOWN.
+ * disabled. If the watchdog is enabled, this function returns -EBUSY.
*
- * Returns: The interrupt timer type supported by the hardware.
+ * Returns: 0 on success or negative error code on failure.
*/
static int atcwdt_get_int_timer_type(struct atcwdt_drv *drv_data)
{
@@ -274,7 +274,8 @@ static int atcwdt_get_int_timer_type(struct atcwdt_drv *drv_data)
regmap_read(drv_data->regmap, REG_CTRL, &val);
if (val & CTRL_WDT_EN) {
spin_unlock(&drv_data->lock);
- return TMR_UNKNOWN;
+ return dev_err_probe(dev, -EBUSY,
+ "Watchdog is enabled, cannot detect timer type\n");
}
/*