Re: [PATCH v4 2/2] watchdog: dw_wdt: manage reset line during system suspend/resume

From: Igor Velkov

Date: Sat Oct 24 2026 - 14:46:54 EST


On Sat, Oct 24, 2026 at 05:08:51PM +0300, Artem Shimko wrote:
> err = clk_prepare_enable(dw_wdt->pclk);
> - if (err) {
> - clk_disable_unprepare(dw_wdt->clk);
> - return err;
> - }
> + if (err)
> + goto unprepare_clk;
> +
> + err = reset_control_deassert(dw_wdt->rst);
> + if (err)
> + goto unprepare_pclk;

If clk_prepare_enable() fails in dw_wdt_resume(), we return with the reset
still asserted. The _deasserted devres then asserts it once more at unbind,
and on a shared control with deassert_count already at 0 that is a WARN_ON
and -EINVAL; the next suspend hits the same. Deasserting before the clocks
are enabled (or on the error paths) keeps every exit balanced.
Not tested on hardware: I can't make the clock enable fail.

v4 re-tested on ROCK Pi 4A (RK3399, resets = <&cru SRST_P_WDT0> added
locally): watchdog daemon at 60 s, 6 x s2idle for 90 s without a reset;
killing the daemon without magic close resets the board.