public inbox for linux-watchdog@vger.kernel.org
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Felix Gu <ustc.gu@gmail.com>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Orson Zhai <orsonzhai@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog: sprd_wdt: Remove redundant sprd_wdt_disable() on register failure
Date: Tue, 24 Feb 2026 09:30:36 +0800	[thread overview]
Message-ID: <5ec9bd47-4c58-485a-bc20-1a74cbdef40b@linux.alibaba.com> (raw)
In-Reply-To: <20260223-sprd_wdt-v1-1-2e71f9a76ecb@gmail.com>



On 2/23/26 7:59 PM, Felix Gu wrote:
> The driver uses devm_add_action_or_reset() to register sprd_wdt_disable()
> as a managed cleanup action.
> 
> When devm_watchdog_register_device() fails, the devm core will invoke
> the cleanup action automatically.
> 
> The explicit sprd_wdt_disable() call in the error path is therefore
> redundant and results in adouble cleanup.
> 
> Fixes: 78d9bfad2e89 ("watchdog: sprd_wdt: Convert to use device managed functions and other improvements")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>

Good catch. Thanks.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

> ---
>   drivers/watchdog/sprd_wdt.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/sprd_wdt.c b/drivers/watchdog/sprd_wdt.c
> index 4e689b6ff141..aacf04616fef 100644
> --- a/drivers/watchdog/sprd_wdt.c
> +++ b/drivers/watchdog/sprd_wdt.c
> @@ -320,10 +320,9 @@ static int sprd_wdt_probe(struct platform_device *pdev)
>   	watchdog_init_timeout(&wdt->wdd, 0, dev);
>   
>   	ret = devm_watchdog_register_device(dev, &wdt->wdd);
> -	if (ret) {
> -		sprd_wdt_disable(wdt);
> +	if (ret)
>   		return ret;
> -	}
> +
>   	platform_set_drvdata(pdev, wdt);
>   
>   	return 0;
> 
> ---
> base-commit: d4906ae14a5f136ceb671bb14cedbf13fa560da6
> change-id: 20260223-sprd_wdt-3e7ec7187f30
> 
> Best regards,


      parent reply	other threads:[~2026-02-24  2:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23 11:59 [PATCH] watchdog: sprd_wdt: Remove redundant sprd_wdt_disable() on register failure Felix Gu
2026-02-23 15:09 ` Guenter Roeck
2026-02-24  1:30 ` Baolin Wang [this message]

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=5ec9bd47-4c58-485a-bc20-1a74cbdef40b@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=orsonzhai@gmail.com \
    --cc=ustc.gu@gmail.com \
    --cc=wim@linux-watchdog.org \
    --cc=zhang.lyra@gmail.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