Re: [PATCH] regulator: core: lock device when calling device_is_bound()
From: Mark Brown
Date: Tue May 19 2026 - 06:54:19 EST
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:
signature.asc
Description: PGP signature