aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/gpio-regulator.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-25 12:50:08 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-25 12:50:08 -0800
commit8e45099e029bb6b369b27d8d4920db8caff5ecce (patch)
tree2ad93eb736e3509140fbb7ab265286d35daf061f /drivers/regulator/gpio-regulator.c
parentslab.h: remove duplicate kmalloc declaration and fix kernel-doc warnings (diff)
parentMerge remote-tracking branch 'regulator/fix/pfuze100' into regulator-linus (diff)
downloadlinux-dev-8e45099e029bb6b369b27d8d4920db8caff5ecce.tar.xz
linux-dev-8e45099e029bb6b369b27d8d4920db8caff5ecce.zip
Merge tag 'regulator-v3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator fixes from Mark Brown: "A bunch of fixes, a few driver specific ones and a framework fix for voltage enumeration on fixed voltage regulators which had previously worked but had been misplaced during some refactoring causing problems for users that needed to know the voltage" * tag 'regulator-v3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: arizona-micsupp: Correct wm5110 voltage selection regulator: pfuze100: allow misprogrammed ID regulator: fixed: fix regulator_list_voltage() for regression regulator: gpio-regulator: Don't oops on missing regulator-type property
Diffstat (limited to 'drivers/regulator/gpio-regulator.c')
-rw-r--r--drivers/regulator/gpio-regulator.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 04406a918c04..234960dc9607 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -139,6 +139,7 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
struct property *prop;
const char *regtype;
int proplen, gpio, i;
+ int ret;
config = devm_kzalloc(dev,
sizeof(struct gpio_regulator_config),
@@ -202,7 +203,11 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
}
config->nr_states = i;
- of_property_read_string(np, "regulator-type", &regtype);
+ ret = of_property_read_string(np, "regulator-type", &regtype);
+ if (ret < 0) {
+ dev_err(dev, "Missing 'regulator-type' property\n");
+ return ERR_PTR(-EINVAL);
+ }
if (!strncmp("voltage", regtype, 7))
config->type = REGULATOR_VOLTAGE;