Skip to content

Commit 79d6f04

Browse files
digetxbroonie
authored andcommitted
regulator: core: Don't allow to get regulator until all couples resolved
Don't allow to get regulator until all of its couples resolved because consumer will get EPERM and coupling shall be transparent for the drivers. Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent f950338 commit 79d6f04

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/regulator/core.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,6 +1747,16 @@ struct regulator *_regulator_get(struct device *dev, const char *id,
17471747
return regulator;
17481748
}
17491749

1750+
mutex_lock(&regulator_list_mutex);
1751+
ret = (rdev->coupling_desc.n_resolved != rdev->coupling_desc.n_coupled);
1752+
mutex_unlock(&regulator_list_mutex);
1753+
1754+
if (ret != 0) {
1755+
regulator = ERR_PTR(-EPROBE_DEFER);
1756+
put_device(&rdev->dev);
1757+
return regulator;
1758+
}
1759+
17501760
ret = regulator_resolve_supply(rdev);
17511761
if (ret < 0) {
17521762
regulator = ERR_PTR(ret);

0 commit comments

Comments
 (0)