Linux Watchdog driver development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org,
	wsa+renesas@sang-engineering.com
Subject: Re: [PATCH v6 4/8] watchdog: rzv2h: Propagate WDTDCR access errors
Date: Wed, 23 Sep 2026 10:48:04 +0000	[thread overview]
Message-ID: <20260923104804.C230E1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923104054.3324830-5-prabhakar.mahadev-lad.rj@bp.renesas.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] watchdog: rzv2h: unconfigured hardware reset on stop error path
--

commit b536187da1b8888ce4af583c2cf2a8479cfaaa53
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

watchdog: rzv2h: Propagate WDTDCR access errors

This commit updates the watchdog start and stop paths to handle WDTDCR
register access errors. It propagates failures back to the caller and
unwinds acquired resources, attempting to restore the reset state.

> diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c
> --- a/drivers/watchdog/rzv2h_wdt.c
> +++ b/drivers/watchdog/rzv2h_wdt.c

[ ... ]

> @@ -169,8 +179,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]
Does this error path unwind leave the hardware in an unconfigured state?

Earlier in rzv2h_wdt_stop(), reset_control_assert() places the watchdog IP
into reset, which clears its configuration registers to default values. If
rzt2h_wdt_wdtdcr_count_stop() fails, this path deasserts the reset line but
does not restore the previous running configuration, missing the required
udelay(3) and rzv2h_wdt_setup() initialization.

Since rzv2h_wdt_stop() returns an error, won't the watchdog core assume the
device is still active and continue to issue keepalive pings?

If the core pings the newly-deasserted but unconfigured watchdog, it seems
this would start the down-counter with default reset register values,
triggering an immediate unintended hardware reset.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260923104054.3324830-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=4

  reply	other threads:[~2026-09-23 10:48 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 10:40 [PATCH v6 0/8] Add syscon support for Renesas WDT driver Prabhakar
2026-09-23 10:40 ` [PATCH v6 1/8] watchdog: rzv2h: Use pm_runtime_put_sync() Prabhakar
2026-09-23 10:40 ` [PATCH v6 2/8] watchdog: rzv2h: Drop enabling clocks in the restart handler Prabhakar
2026-09-23 10:40 ` [PATCH v6 3/8] watchdog: rzv2h: Drop WDTRCR_RSTIRQS define Prabhakar
2026-09-23 10:40 ` [PATCH v6 4/8] watchdog: rzv2h: Propagate WDTDCR access errors Prabhakar
2026-09-23 10:48   ` sashiko-bot [this message]
2026-09-23 21:17   ` Guenter Roeck
2026-09-24 12:59     ` Lad, Prabhakar
2026-09-23 21:19   ` Guenter Roeck
2026-09-23 10:40 ` [PATCH v6 5/8] watchdog: rzv2h: Convert WDTDCR handling to regmap Prabhakar
2026-09-23 10:40 ` [PATCH v6 6/8] watchdog: rzv2h: Add syscon support for WDTDCR Prabhakar
2026-09-23 10:52   ` sashiko-bot
2026-09-24 13:44     ` Lad, Prabhakar
2026-09-24 21:48       ` Guenter Roeck
2026-09-25  4:13         ` Biju Das
2026-09-25  4:50           ` Guenter Roeck
2026-09-25  5:11             ` Biju Das
2026-09-25  9:06               ` Lad, Prabhakar
2026-09-25  9:09                 ` Geert Uytterhoeven
2026-09-25  9:20                   ` Lad, Prabhakar
2026-09-25 12:24                     ` Lad, Prabhakar
2026-09-25 13:41                       ` Guenter Roeck
2026-09-23 10:40 ` [PATCH v6 7/8] arm64: dts: renesas: r9a09g077: Use CPG/MSSR syscon for WDTDCR access Prabhakar
2026-09-23 11:05   ` sashiko-bot
2026-09-23 10:40 ` [PATCH v6 8/8] arm64: dts: renesas: r9a09g087: " Prabhakar
2026-09-23 10:53   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260923104804.C230E1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=prabhakar.csengg@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox