Re: [PATCH RFC v2 7/9] watchdog: rzv2h: Add syscon support for RZ/T2H and RZ/N2H WDT control register

[email protected]
Newsgroups org.kernel.vger.linux-watchdog,org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The error rollback path in `rzv2h_wdt_stop()` leaves the watchdog deasserted but unconfigured, breaking the hardware state machine and potentially causing spurious resets.
--

commit e9173a2a019341cec05cdc87e042bd8dd2f92721
Author: Lad Prabhakar <[email protected]>

watchdog: rzv2h: Add syscon support for RZ/T2H and RZ/N2H WDT control register

On RZ/T2H and RZ/N2H SoCs, the WDTDCR register is shared and managed by a
dedicated SYS driver. This commit updates the WDT driver to support a syscon
regmap interface for WDTDCR control while maintaining backward compatibility
with direct mapping.

> diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c
> index e9545b8f5fd09..e14ff853a4e9f 100644
> --- a/drivers/watchdog/rzv2h_wdt.c
> +++ b/drivers/watchdog/rzv2h_wdt.c

[ ... ]

> @@ -179,8 +208,13 @@ static int rzv2h_wdt_stop(struct watchdog_device *wdev)
>  	if (ret)
>  		return ret;
>  
> -	if (priv->of_data->wdtdcr)
> -		rzt2h_wdt_wdtdcr_count_stop(priv);
> +	if (priv->of_data->wdtdcr) {
> +		ret = rzt2h_wdt_wdtdcr_count_stop(priv);
> +		if (ret) {
> +			reset_control_deassert(priv->rstc);
> +			return ret;
> +		}
> +	}

[Severity: High]
When rzt2h_wdt_wdtdcr_count_stop() fails, this rollback path deasserts the
reset line and returns an error without reconfiguring the hardware.

Because rzv2h_wdt_stop() returns an error, the watchdog subsystem will keep
the device marked as active and continue pinging it via rzv2h_wdt_ping().

Since the earlier reset_control_assert() wiped the configuration registers,
will the subsequent ping lock the unconfigured control registers and
potentially cause an immediate spurious system reset?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.