mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: William Breathitt Gray <wbg@kernel.org>
Cc: Stepan Ionichev <sozdayvek@gmail.com>,
	o.rempel@pengutronix.de, kernel@pengutronix.de,
	joshua.crofts1@gmail.com, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, andy@kernel.org
Subject: Re: [PATCH v2] counter: interrupt-cnt: use devm_mutex_init()
Date: Wed, 27 May 2026 17:55:13 +0100	[thread overview]
Message-ID: <20260527175513.0df47897@jic23-huawei> (raw)
In-Reply-To: <20260527065632.502242-1-wbg@kernel.org>

On Wed, 27 May 2026 15:56:31 +0900
William Breathitt Gray <wbg@kernel.org> wrote:

> On Mon, May 25, 2026 at 08:11:52PM +0500, Stepan Ionichev wrote:
> > interrupt_cnt_probe() calls mutex_init() but neither this driver
> > nor the counter core issues a matching mutex_destroy() on unbind,
> > which leaks the lock debug state when CONFIG_DEBUG_MUTEXES is
> > enabled.
> > 
> > Switch to devm_mutex_init() so the mutex is torn down in the same
> > devm scope it was set up in.
> > 
> > Fixes: a55ebd47f21f ("counter: add IRQ or GPIO based counter")  
> 
> The mutex_init() code was added in 7351312632e8 ("counter:
> interrupt-cnt: Protect enable/disable OPs with mutex"), so the Fixes tag
> should refer to that commit.
> 

Not a fix.   For a long time it was common to take the view that
mutex_destroy() was only useful if you had marginally complex lifetime
handling in a driver and it might help detect bugs.

Now devm_mutex_init() makes it easier to do, the barrier to deciding
to have that protection is reduced, so we apply it to more drivers
(for IIO I now ask for this always).  That doesn't make it a fix as such,
more of an update to modern approaches and definitely not suitable for
the backports that will likely cause.  So I'd drop the fixes tag.

Jonathan

> William Breathitt Gray
> 


      reply	other threads:[~2026-05-27 16:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-25 15:11 Stepan Ionichev
2026-05-27  6:56 ` William Breathitt Gray
2026-05-27 16:55   ` Jonathan Cameron [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=20260527175513.0df47897@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=joshua.crofts1@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=sozdayvek@gmail.com \
    --cc=wbg@kernel.org \
    /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

all inboxes | Powered by JetHome®