aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2012-11-14 06:51:36 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-11-14 06:58:09 -0500
commit216f2b9c95ac6e4f00b08df807bc4454434a9afb (patch)
tree5465802601b41d58bed5081b89c089da128d4731 /drivers/regulator
parentf8a9f757cb425c4784b80b001c7a77c7810b499f (diff)
regulator: gpio-regulator: Catch 'no states property' misuse
A selection of voltage or current values (AKA states) should always be specified when using a GPIO regulator. If there are no switchable states then the fixed regulators should be used instead. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/gpio-regulator.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index faa2f712eb0d..dc9260545b80 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -183,6 +183,11 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
183 183
184 /* Fetch states. */ 184 /* Fetch states. */
185 prop = of_find_property(np, "states", NULL); 185 prop = of_find_property(np, "states", NULL);
186 if (!prop) {
187 dev_err(dev, "No 'states' property found\n");
188 return ERR_PTR(-EINVAL);
189 }
190
186 proplen = prop->length / sizeof(int); 191 proplen = prop->length / sizeof(int);
187 192
188 config->states = devm_kzalloc(dev, 193 config->states = devm_kzalloc(dev,