mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Jon Hunter <jonathanh@nvidia.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regulator: core: lock device when calling device_is_bound()
Date: Tue, 19 May 2026 11:40:08 +0100	[thread overview]
Message-ID: <766cad6e-e553-4ede-9e5c-e03d46b979e2@sirena.org.uk> (raw)
In-Reply-To: <20260518102015.51704-1-bartosz.golaszewski@oss.qualcomm.com>

[-- Attachment #1: Type: text/plain, Size: 801 bytes --]

On Mon, May 18, 2026 at 12:20:15PM +0200, Bartosz Golaszewski wrote:

> @@ -2240,10 +2240,12 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
>  	 * device get probe deferred and unregisters the supply.
>  	 */
>  	if (r->dev.parent && r->dev.parent != rdev->dev.parent) {
> -		if (!device_is_bound(r->dev.parent)) {
> -			put_device(&r->dev);
> -			ret = -EPROBE_DEFER;
> -			goto out;
> +		scoped_guard(device, r->dev.parent) {
> +			if (!device_is_bound(r->dev.parent)) {
> +				put_device(&r->dev);
> +				ret = -EPROBE_DEFER;
> +				goto out;
> +			}

How does this work if a regulator is being registered in the context of
a MFD registering it's children from probe()?

I'm also not convinced that mixing a scoped guard into the middle of
goto based cleanup is the best thing.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2026-05-19 10:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18 10:20 Bartosz Golaszewski
2026-05-19 10:40 ` Mark Brown [this message]
2026-05-19 11:29   ` Bartosz Golaszewski

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=766cad6e-e553-4ede-9e5c-e03d46b979e2@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=jonathanh@nvidia.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@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 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®