mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regulator: core: lock device when calling device_is_bound()
@ 2026-05-18 10:20 Bartosz Golaszewski
  2026-05-19 10:40 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Bartosz Golaszewski @ 2026-05-18 10:20 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jon Hunter; +Cc: linux-kernel, Bartosz Golaszewski

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-19 11:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-18 10:20 [PATCH] regulator: core: lock device when calling device_is_bound() Bartosz Golaszewski
2026-05-19 10:40 ` Mark Brown
2026-05-19 11:29   ` Bartosz Golaszewski

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®