All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Breathitt Gray <wbg@kernel.org>
To: Stepan Ionichev <sozdayvek@gmail.com>
Cc: William Breathitt Gray <wbg@kernel.org>,
	Joshua Crofts <joshua.crofts1@gmail.com>,
	Jonathan Cameron <jic23@kernel.org>,
	patrick.havelange@essensium.com, peng.fan@nxp.com,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	andy@kernel.org
Subject: Re: [PATCH v2] counter: ftm-quaddec: use devm_mutex_init()
Date: Fri, 29 May 2026 11:08:28 +0900	[thread overview]
Message-ID: <20260529020829.613952-1-wbg@kernel.org> (raw)
In-Reply-To: <20260528140745.033560d6@jic23-huawei>

On Thu, May 28, 2026 at 02:07:45PM +0100, Jonathan Cameron wrote:
> On Thu, 28 May 2026 06:52:18 +0900
> William Breathitt Gray <wbg@kernel.org> wrote:
> 
> > On Wed, May 27, 2026 at 05:57:58PM +0100, Jonathan Cameron wrote:
> > > On Tue, 26 May 2026 12:24:25 +0200
> > > Joshua Crofts <joshua.crofts1@gmail.com> wrote:
> > >
> > > > On Mon, 25 May 2026 at 17:14, Stepan Ionichev <sozdayvek@gmail.com> wrote:
> > > > >
> > > > > ftm_quaddec_probe() calls mutex_init() but neither the cleanup
> > > > > action nor a remove callback issues a matching mutex_destroy(),
> > > > > 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: a3b9a99980d9 ("counter: add FlexTimer Module Quadrature decoder counter driver")
> > > > > Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
> > > > > ---
> > > > > v2:
> > > > > - Add Fixes tag and note that the leak only shows up under
> > >
> > > It's not a leak as such. All that happens is the 'magic' pointer embedded
> > > in the lock is not set NULL. No memory or counters or anything like that leaked
> > > in current mainline where the implementation with CONFIG_DEBUG_MUTEXES is
> > >
> > > void mutex_destroy(struct mutex *lock)
> > > {
> > > 	DEBUG_LOCKS_WARN_ON(mutex_is_locked(lock));
> > > 	lock->magic = NULL;
> > > }
> >
> > What is the purpose of the magic pointer? Is it just informational, to
> > catch instances where any attempt to use the mutex occurs after the
> > device memory is freed for example?
> More or less. In some cases the mutex life can be less than the structure
> containing it.

Stepan,

I think Jonathan is right, so I'm going to drop the Fixes tag for this
one, and pick up as well the original revision of your interrupt-cnt
patch without the Fixes tag. Sorry for the noise.

Thank you,

William Breathitt Gray

  reply	other threads:[~2026-05-29  2:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-25 15:12 [PATCH v2] counter: ftm-quaddec: use devm_mutex_init() Stepan Ionichev
2026-05-26 10:24 ` Joshua Crofts
2026-05-27 16:57   ` Jonathan Cameron
2026-05-27 21:52     ` William Breathitt Gray
2026-05-28 13:07       ` Jonathan Cameron
2026-05-29  2:08         ` William Breathitt Gray [this message]
2026-05-27  7:02 ` William Breathitt Gray

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=20260529020829.613952-1-wbg@kernel.org \
    --to=wbg@kernel.org \
    --cc=andy@kernel.org \
    --cc=jic23@kernel.org \
    --cc=joshua.crofts1@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patrick.havelange@essensium.com \
    --cc=peng.fan@nxp.com \
    --cc=sozdayvek@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.