Merge remote-tracking branches 'regulator/topic/db8500', 'regulator/topic/gpio',...
[pandora-kernel.git] / drivers / regulator / gpio-regulator.c
index 04406a9..c0a1d00 100644 (file)
@@ -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", &regtype);
-
-       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", &regtype);
+       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;
 }