Merge remote-tracking branch 'regulator/fix/gpio' into regulator-linus
authorMark Brown <broonie@linaro.org>
Sun, 24 Nov 2013 14:02:48 +0000 (14:02 +0000)
committerMark Brown <broonie@linaro.org>
Sun, 24 Nov 2013 14:02:48 +0000 (14:02 +0000)
1  2 
drivers/regulator/gpio-regulator.c

@@@ -139,6 -139,7 +139,7 @@@ of_get_gpio_regulator_config(struct dev
        struct property *prop;
        const char *regtype;
        int proplen, gpio, i;
+       int ret;
  
        config = devm_kzalloc(dev,
                        sizeof(struct gpio_regulator_config),
        }
        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;
@@@ -283,6 -288,7 +288,6 @@@ static int gpio_regulator_probe(struct 
                dev_err(&pdev->dev, "No regulator type set\n");
                ret = -EINVAL;
                goto err_memgpio;
 -              break;
        }
  
        drvdata->nr_gpios = config->nr_gpios;