regulator: check that dummy regulator has been probed before using it
commit 2c7a50bec4 upstream.
Due to asynchronous driver probing there is a chance that the dummy
regulator hasn't already been probed when first accessing it.
Cc: stable@vger.kernel.org
Signed-off-by: Christian Eggers <ceggers@arri.de>
Link: https://patch.msgid.link/20250313103051.32430-3-ceggers@arri.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f45a322c99
commit
8e50018090
@@ -2047,6 +2047,10 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
|
||||
|
||||
if (have_full_constraints()) {
|
||||
r = dummy_regulator_rdev;
|
||||
if (!r) {
|
||||
ret = -EPROBE_DEFER;
|
||||
goto out;
|
||||
}
|
||||
get_device(&r->dev);
|
||||
} else {
|
||||
dev_err(dev, "Failed to resolve %s-supply for %s\n",
|
||||
@@ -2064,6 +2068,10 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
|
||||
goto out;
|
||||
}
|
||||
r = dummy_regulator_rdev;
|
||||
if (!r) {
|
||||
ret = -EPROBE_DEFER;
|
||||
goto out;
|
||||
}
|
||||
get_device(&r->dev);
|
||||
}
|
||||
|
||||
@@ -2172,8 +2180,10 @@ struct regulator *_regulator_get(struct device *dev, const char *id,
|
||||
* enabled, even if it isn't hooked up, and just
|
||||
* provide a dummy.
|
||||
*/
|
||||
dev_warn(dev, "supply %s not found, using dummy regulator\n", id);
|
||||
rdev = dummy_regulator_rdev;
|
||||
if (!rdev)
|
||||
return ERR_PTR(-EPROBE_DEFER);
|
||||
dev_warn(dev, "supply %s not found, using dummy regulator\n", id);
|
||||
get_device(&rdev->dev);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user