* [PATCH v2] watchdog: atcwdt200: fix return value when watchdog is enabled
@ 2026-07-23 2:26 kr494167
2026-07-23 5:12 ` Guenter Roeck
2026-07-23 23:01 ` Guenter Roeck
0 siblings, 2 replies; 3+ messages in thread
From: kr494167 @ 2026-07-23 2:26 UTC (permalink / raw)
To: linux, wim, cl634; +Cc: linux-watchdog, linux-kernel, Surendra Singh Chouhan
From: Surendra Singh Chouhan <kr494167@gmail.com>
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>
---
drivers/watchdog/atcwdt200_wdt.c | 7 ++++---
1 file 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");
}
/*
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] watchdog: atcwdt200: fix return value when watchdog is enabled
2026-07-23 2:26 [PATCH v2] watchdog: atcwdt200: fix return value when watchdog is enabled kr494167
@ 2026-07-23 5:12 ` Guenter Roeck
2026-07-23 23:01 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2026-07-23 5:12 UTC (permalink / raw)
To: kr494167, wim, cl634; +Cc: linux-watchdog, linux-kernel
On 7/22/26 19:26, kr494167@gmail.com wrote:
> From: Surendra Singh Chouhan <kr494167@gmail.com>
>
> 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>
> ---]
Change log goes here. Do you really expect me to look up the patch history
to figure out what changed from v1 ?
Sure, this one was recent enough that I happen to remember, but
I seriously fail to understand why people can't be bothered to
add a couple of lines here to explain the changes they made.
Guenter
> drivers/watchdog/atcwdt200_wdt.c | 7 ++++---
> 1 file 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");
> }
>
> /*
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] watchdog: atcwdt200: fix return value when watchdog is enabled
2026-07-23 2:26 [PATCH v2] watchdog: atcwdt200: fix return value when watchdog is enabled kr494167
2026-07-23 5:12 ` Guenter Roeck
@ 2026-07-23 23:01 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2026-07-23 23:01 UTC (permalink / raw)
To: kr494167; +Cc: wim, cl634, linux-watchdog, linux-kernel
On Thu, Jul 23, 2026 at 07:56:34AM +0530, kr494167@gmail.com wrote:
> From: Surendra Singh Chouhan <kr494167@gmail.com>
>
> 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>
Applied. Next time please provide a change log.
Guenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-23 23:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-23 2:26 [PATCH v2] watchdog: atcwdt200: fix return value when watchdog is enabled kr494167
2026-07-23 5:12 ` Guenter Roeck
2026-07-23 23:01 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®