Re: [PATCH v2 2/3] watchdog: dw_wdt: manage reset line during system suspend/resume
From: Tzung-Bi Shih
Date: Thu Oct 22 2026 - 23:06:04 EST
On Thu, Oct 22, 2026 at 04:43:50PM +0300, Artem Shimko wrote:
> diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
> index 2cffe337b4ea..ec6a09673da4 100644
> --- a/drivers/watchdog/dw_wdt.c
> +++ b/drivers/watchdog/dw_wdt.c
> @@ -382,6 +382,8 @@ static int dw_wdt_suspend(struct device *dev)
> dw_wdt->control = readl(dw_wdt->regs + WDOG_CONTROL_REG_OFFSET);
> dw_wdt->timeout = readl(dw_wdt->regs + WDOG_TIMEOUT_RANGE_REG_OFFSET);
>
> + reset_control_assert(dw_wdt->rst);
> +
Doesn't it need to check the return value and propagate the error just
like what dw_wdt_resume() does in the patch?
> @@ -402,12 +404,22 @@ static int dw_wdt_resume(struct device *dev)
> return err;
> }
>
> + err = reset_control_deassert(dw_wdt->rst);
> + if (err)
> + goto unprepare_pclk;
> +
> writel(dw_wdt->timeout, dw_wdt->regs + WDOG_TIMEOUT_RANGE_REG_OFFSET);
> writel(dw_wdt->control, dw_wdt->regs + WDOG_CONTROL_REG_OFFSET);
>
> dw_wdt_ping(&dw_wdt->wdd);
>
> return 0;
> +
> +unprepare_pclk:
> + clk_disable_unprepare(dw_wdt->pclk);
> + clk_disable_unprepare(dw_wdt->clk);
> +
> + return err;
There is only one user of `unprepare_pclk`. Two options:
A) Drop the goto label and inline the cleanup within `if (err) ...`.
B) Refactor error handling for clk_prepare_enable() to use stacked goto
labels.
I just realized [PATCH v2 3/3] actually does option B. Please consider
squashing patch 3/3 into this patch.