mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
To: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Jon Hunter <jonathanh@nvidia.com>
Cc: linux-kernel@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Subject: [PATCH] regulator: core: lock device when calling device_is_bound()
Date: Mon, 18 May 2026 12:20:15 +0200	[thread overview]
Message-ID: <20260518102015.51704-1-bartosz.golaszewski@oss.qualcomm.com> (raw)

device_is_bound() must be called with the device lock taken. Add missing
synchronization in regulator_resolve_supply().

Fixes: 66d228a2bf03 ("regulator: core: Don't use regulators as supplies until the parent is bound")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
 drivers/regulator/core.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index dc5d67767336..1274a1ff8e17 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -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;
+			}
 		}
 	}
 
-- 
2.47.3


             reply	other threads:[~2026-05-18 10:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18 10:20 Bartosz Golaszewski [this message]
2026-05-19 10:40 ` Mark Brown
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=20260518102015.51704-1-bartosz.golaszewski@oss.qualcomm.com \
    --to=bartosz.golaszewski@oss.qualcomm.com \
    --cc=broonie@kernel.org \
    --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®