All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Runyu Xiao <runyu.xiao@seu.edu.cn>,
	Antoniu Miclaus <antoniu.miclaus@analog.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	David Lechner <dlechner@baylibre.com>,
	Nuno Sa <nuno.sa@analog.com>, Andy Shevchenko <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, Jianhao Xu <jianhao.xu@seu.edu.cn>
Subject: Re: [PATCH] iio: admv1013: initialize callback mutex before registering notifier
Date: Wed, 19 Aug 2026 01:46:11 +0100	[thread overview]
Message-ID: <20260819014611.18db8689@jic23-huawei> (raw)
In-Reply-To: <aoR6tWAewJiVxOBS@ashevche-desk.local>

On Tue, 18 Aug 2026 18:31:01 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Tue, Aug 18, 2026 at 10:28:11PM +0800, Runyu Xiao wrote:
> > admv1013_probe() registers a clock notifier whose callback takes
> > st->lock on POST_RATE_CHANGE. Initialize the mutex before
> > devm_clk_notifier_register() so the callback cannot observe an
> > uninitialized lock during probe.  
> 
> ...
> 

Move the (devm_)mutex_init() up here to keep the notifier setup all together
after the change as it was before.


> >  	st->nb.notifier_call = admv1013_freq_change;  
> 
> > +	mutex_init(&st->lock);
> > +  
> 
> Make it also to be devm_mutex_init().

Hmm. I'm a bit borderline on this as the minimal fix is indeed the
move done here. I guess it is trivial to do the
	ret = devm_mutex_init(&st->lock);
	if (ret)
		return ret;

so we might as well do that as part of the fix rather than
adding churn by doing it as a follow up.  So indeed, lets
have that for v2.

Thanks,

Jonathan

> 
> >  	ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb);
> >  	if (ret)
> >  		return ret;  
> 


  reply	other threads:[~2026-08-19  0:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 14:28 [PATCH] iio: admv1013: initialize callback mutex before registering notifier Runyu Xiao
2026-08-18 15:31 ` Andy Shevchenko
2026-08-19  0:46   ` Jonathan Cameron [this message]
2026-08-19 14:17     ` [PATCH v2] " Runyu Xiao
2026-08-23  0:02       ` Jonathan Cameron

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=20260819014611.18db8689@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=dlechner@baylibre.com \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=runyu.xiao@seu.edu.cn \
    --cc=stable@vger.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 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.