Linux-Watchdog Archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Ben Dooks <ben.dooks@codethink.co.uk>
Cc: linux-watchdog@vger.kernel.org, wim@linux-watchdog.org,
	samin.guo@starfivetech.com, xingyu.wu@starfivetech.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog: starfive: add lock annotations to fix context imbalances
Date: Tue, 12 Dec 2023 08:54:45 -0800	[thread overview]
Message-ID: <794a9aa8-b948-4479-98fd-4417c0f08965@roeck-us.net> (raw)
In-Reply-To: <20231122085118.177589-1-ben.dooks@codethink.co.uk>

On Wed, Nov 22, 2023 at 08:51:18AM +0000, Ben Dooks wrote:
> Add the necessary __acquires() and __releases() to the functions
> that take and release the wdt lock to avoid the following sparse
> warnings:
> 
> drivers/watchdog/starfive-wdt.c:204:13: warning: context imbalance in 'starfive_wdt_unlock' - wrong count at exit
> drivers/watchdog/starfive-wdt.c:212:9: warning: context imbalance in 'starfive_wdt_lock' - unexpected unlock
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/starfive-wdt.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
> index 5f501b41faf9..49b38ecc092d 100644
> --- a/drivers/watchdog/starfive-wdt.c
> +++ b/drivers/watchdog/starfive-wdt.c
> @@ -202,12 +202,14 @@ static u32 starfive_wdt_ticks_to_sec(struct starfive_wdt *wdt, u32 ticks)
>  
>  /* Write unlock-key to unlock. Write other value to lock. */
>  static void starfive_wdt_unlock(struct starfive_wdt *wdt)
> +	__acquires(&wdt->lock)
>  {
>  	spin_lock(&wdt->lock);
>  	writel(wdt->variant->unlock_key, wdt->base + wdt->variant->unlock);
>  }
>  
>  static void starfive_wdt_lock(struct starfive_wdt *wdt)
> +	__releases(&wdt->lock)
>  {
>  	writel(~wdt->variant->unlock_key, wdt->base + wdt->variant->unlock);
>  	spin_unlock(&wdt->lock);
> -- 
> 2.37.2.352.g3c44437643
> 
> 

      parent reply	other threads:[~2023-12-12 16:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22  8:51 [PATCH] watchdog: starfive: add lock annotations to fix context imbalances Ben Dooks
2023-11-22 14:58 ` Guenter Roeck
2023-12-12 16:54 ` Guenter Roeck [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=794a9aa8-b948-4479-98fd-4417c0f08965@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=ben.dooks@codethink.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=samin.guo@starfivetech.com \
    --cc=wim@linux-watchdog.org \
    --cc=xingyu.wu@starfivetech.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).