X-Git-Url: http://git.monstr.eu/?a=blobdiff_plain;f=drivers%2Fregulator%2Fgpio-regulator.c;h=c0a1d00b78c932a6982961334f9e3e9501592c50;hb=a2a2be6309285857bfbc66f83e164331828e93c2;hp=04406a918c041b5773adcf9adf331eadf289caf4;hpb=52f48bf33dff6ac261c77a1da6b9f6ab67509d37;p=linux-2.6-microblaze.git diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index 04406a918c04..c0a1d00b78c9 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,12 +203,17 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np) } config->nr_states = i; - of_property_read_string(np, "regulator-type", ®type); - - if (!strncmp("voltage", regtype, 7)) - config->type = REGULATOR_VOLTAGE; - else if (!strncmp("current", regtype, 7)) - config->type = REGULATOR_CURRENT; + config->type = REGULATOR_VOLTAGE; + ret = of_property_read_string(np, "regulator-type", ®type); + if (ret >= 0) { + if (!strncmp("voltage", regtype, 7)) + config->type = REGULATOR_VOLTAGE; + else if (!strncmp("current", regtype, 7)) + config->type = REGULATOR_CURRENT; + else + dev_warn(dev, "Unknown regulator-type '%s'\n", + regtype); + } return config; }