X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=drivers%2Fregulator%2Fgpio-regulator.c;fp=drivers%2Fregulator%2Fgpio-regulator.c;h=c0a1d00b78c932a6982961334f9e3e9501592c50;hb=a2a2be6309285857bfbc66f83e164331828e93c2;hp=98a98ffa7fe07d2bcb23f2c9cad593b416aaf203;hpb=c6a21f246263dfe1689d827af4200c64679dcc77;p=~andy%2Flinux diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index 98a98ffa7fe..c0a1d00b78c 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; } @@ -283,7 +289,6 @@ static int gpio_regulator_probe(struct platform_device *pdev) dev_err(&pdev->dev, "No regulator type set\n"); ret = -EINVAL; goto err_memgpio; - break; } drvdata->nr_gpios = config->nr_gpios;