diff options
| -rw-r--r-- | drivers/regulator/88pm8607.c | 3 | ||||
| -rw-r--r-- | drivers/regulator/da9052-regulator.c | 5 | ||||
| -rw-r--r-- | drivers/regulator/max8907-regulator.c | 7 | ||||
| -rw-r--r-- | drivers/regulator/max8925-regulator.c | 3 | ||||
| -rw-r--r-- | drivers/regulator/max8997.c | 4 | ||||
| -rw-r--r-- | drivers/regulator/mc13xxx-regulator-core.c | 7 | ||||
| -rw-r--r-- | drivers/regulator/palmas-regulator.c | 2 | ||||
| -rw-r--r-- | drivers/regulator/tps65910-regulator.c | 6 |
8 files changed, 26 insertions, 11 deletions
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c index 2b557119adad..e99a3e48b880 100644 --- a/drivers/regulator/88pm8607.c +++ b/drivers/regulator/88pm8607.c | |||
| @@ -372,7 +372,7 @@ static int pm8607_regulator_dt_init(struct platform_device *pdev, | |||
| 372 | struct regulator_config *config) | 372 | struct regulator_config *config) |
| 373 | { | 373 | { |
| 374 | struct device_node *nproot, *np; | 374 | struct device_node *nproot, *np; |
| 375 | nproot = pdev->dev.parent->of_node; | 375 | nproot = of_node_get(pdev->dev.parent->of_node); |
| 376 | if (!nproot) | 376 | if (!nproot) |
| 377 | return -ENODEV; | 377 | return -ENODEV; |
| 378 | nproot = of_find_node_by_name(nproot, "regulators"); | 378 | nproot = of_find_node_by_name(nproot, "regulators"); |
| @@ -388,6 +388,7 @@ static int pm8607_regulator_dt_init(struct platform_device *pdev, | |||
| 388 | break; | 388 | break; |
| 389 | } | 389 | } |
| 390 | } | 390 | } |
| 391 | of_node_put(nproot); | ||
| 391 | return 0; | 392 | return 0; |
| 392 | } | 393 | } |
| 393 | #else | 394 | #else |
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c index d0963090442d..29d194c8a310 100644 --- a/drivers/regulator/da9052-regulator.c +++ b/drivers/regulator/da9052-regulator.c | |||
| @@ -395,9 +395,9 @@ static int da9052_regulator_probe(struct platform_device *pdev) | |||
| 395 | config.init_data = pdata->regulators[pdev->id]; | 395 | config.init_data = pdata->regulators[pdev->id]; |
| 396 | } else { | 396 | } else { |
| 397 | #ifdef CONFIG_OF | 397 | #ifdef CONFIG_OF |
| 398 | struct device_node *nproot = da9052->dev->of_node; | 398 | struct device_node *nproot, *np; |
| 399 | struct device_node *np; | ||
| 400 | 399 | ||
| 400 | nproot = of_node_get(da9052->dev->of_node); | ||
| 401 | if (!nproot) | 401 | if (!nproot) |
| 402 | return -ENODEV; | 402 | return -ENODEV; |
| 403 | 403 | ||
| @@ -414,6 +414,7 @@ static int da9052_regulator_probe(struct platform_device *pdev) | |||
| 414 | break; | 414 | break; |
| 415 | } | 415 | } |
| 416 | } | 416 | } |
| 417 | of_node_put(nproot); | ||
| 417 | #endif | 418 | #endif |
| 418 | } | 419 | } |
| 419 | 420 | ||
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c index d40cf7fdb546..4568c15fa78d 100644 --- a/drivers/regulator/max8907-regulator.c +++ b/drivers/regulator/max8907-regulator.c | |||
| @@ -224,11 +224,11 @@ static struct of_regulator_match max8907_matches[] = { | |||
| 224 | 224 | ||
| 225 | static int max8907_regulator_parse_dt(struct platform_device *pdev) | 225 | static int max8907_regulator_parse_dt(struct platform_device *pdev) |
| 226 | { | 226 | { |
| 227 | struct device_node *np = pdev->dev.parent->of_node; | 227 | struct device_node *np, *regulators; |
| 228 | struct device_node *regulators; | ||
| 229 | int ret; | 228 | int ret; |
| 230 | 229 | ||
| 231 | if (!pdev->dev.parent->of_node) | 230 | np = of_node_get(pdev->dev.parent->of_node); |
| 231 | if (!np) | ||
| 232 | return 0; | 232 | return 0; |
| 233 | 233 | ||
| 234 | regulators = of_find_node_by_name(np, "regulators"); | 234 | regulators = of_find_node_by_name(np, "regulators"); |
| @@ -239,6 +239,7 @@ static int max8907_regulator_parse_dt(struct platform_device *pdev) | |||
| 239 | 239 | ||
| 240 | ret = of_regulator_match(&pdev->dev, regulators, max8907_matches, | 240 | ret = of_regulator_match(&pdev->dev, regulators, max8907_matches, |
| 241 | ARRAY_SIZE(max8907_matches)); | 241 | ARRAY_SIZE(max8907_matches)); |
| 242 | of_node_put(regulators); | ||
| 242 | if (ret < 0) { | 243 | if (ret < 0) { |
| 243 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", | 244 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", |
| 244 | ret); | 245 | ret); |
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index 446a85445553..0d5f64a805a0 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c | |||
| @@ -252,7 +252,7 @@ static int max8925_regulator_dt_init(struct platform_device *pdev, | |||
| 252 | { | 252 | { |
| 253 | struct device_node *nproot, *np; | 253 | struct device_node *nproot, *np; |
| 254 | int rcount; | 254 | int rcount; |
| 255 | nproot = pdev->dev.parent->of_node; | 255 | nproot = of_node_get(pdev->dev.parent->of_node); |
| 256 | if (!nproot) | 256 | if (!nproot) |
| 257 | return -ENODEV; | 257 | return -ENODEV; |
| 258 | np = of_find_node_by_name(nproot, "regulators"); | 258 | np = of_find_node_by_name(nproot, "regulators"); |
| @@ -263,6 +263,7 @@ static int max8925_regulator_dt_init(struct platform_device *pdev, | |||
| 263 | 263 | ||
| 264 | rcount = of_regulator_match(&pdev->dev, np, | 264 | rcount = of_regulator_match(&pdev->dev, np, |
| 265 | &max8925_regulator_matches[ridx], 1); | 265 | &max8925_regulator_matches[ridx], 1); |
| 266 | of_node_put(np); | ||
| 266 | if (rcount < 0) | 267 | if (rcount < 0) |
| 267 | return -ENODEV; | 268 | return -ENODEV; |
| 268 | config->init_data = max8925_regulator_matches[ridx].init_data; | 269 | config->init_data = max8925_regulator_matches[ridx].init_data; |
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index 836908ce505e..5abd0d3288f0 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c | |||
| @@ -960,7 +960,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
| 960 | struct max8997_regulator_data *rdata; | 960 | struct max8997_regulator_data *rdata; |
| 961 | unsigned int i, dvs_voltage_nr = 1, ret; | 961 | unsigned int i, dvs_voltage_nr = 1, ret; |
| 962 | 962 | ||
| 963 | pmic_np = iodev->dev->of_node; | 963 | pmic_np = of_node_get(iodev->dev->of_node); |
| 964 | if (!pmic_np) { | 964 | if (!pmic_np) { |
| 965 | dev_err(&pdev->dev, "could not find pmic sub-node\n"); | 965 | dev_err(&pdev->dev, "could not find pmic sub-node\n"); |
| 966 | return -ENODEV; | 966 | return -ENODEV; |
| @@ -980,6 +980,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
| 980 | rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * | 980 | rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * |
| 981 | pdata->num_regulators, GFP_KERNEL); | 981 | pdata->num_regulators, GFP_KERNEL); |
| 982 | if (!rdata) { | 982 | if (!rdata) { |
| 983 | of_node_put(regulators_np); | ||
| 983 | dev_err(&pdev->dev, "could not allocate memory for regulator data\n"); | 984 | dev_err(&pdev->dev, "could not allocate memory for regulator data\n"); |
| 984 | return -ENOMEM; | 985 | return -ENOMEM; |
| 985 | } | 986 | } |
| @@ -1002,6 +1003,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
| 1002 | rdata->reg_node = reg_np; | 1003 | rdata->reg_node = reg_np; |
| 1003 | rdata++; | 1004 | rdata++; |
| 1004 | } | 1005 | } |
| 1006 | of_node_put(regulators_np); | ||
| 1005 | 1007 | ||
| 1006 | if (of_get_property(pmic_np, "max8997,pmic-buck1-uses-gpio-dvs", NULL)) | 1008 | if (of_get_property(pmic_np, "max8997,pmic-buck1-uses-gpio-dvs", NULL)) |
| 1007 | pdata->buck1_gpiodvs = true; | 1009 | pdata->buck1_gpiodvs = true; |
diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c index 2ecf1d8b6a94..5d2ab2ea0c8c 100644 --- a/drivers/regulator/mc13xxx-regulator-core.c +++ b/drivers/regulator/mc13xxx-regulator-core.c | |||
| @@ -175,6 +175,7 @@ int mc13xxx_get_num_regulators_dt(struct platform_device *pdev) | |||
| 175 | for_each_child_of_node(parent, child) | 175 | for_each_child_of_node(parent, child) |
| 176 | num++; | 176 | num++; |
| 177 | 177 | ||
| 178 | of_node_put(parent); | ||
| 178 | return num; | 179 | return num; |
| 179 | } | 180 | } |
| 180 | EXPORT_SYMBOL_GPL(mc13xxx_get_num_regulators_dt); | 181 | EXPORT_SYMBOL_GPL(mc13xxx_get_num_regulators_dt); |
| @@ -197,8 +198,11 @@ struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt( | |||
| 197 | 198 | ||
| 198 | data = devm_kzalloc(&pdev->dev, sizeof(*data) * priv->num_regulators, | 199 | data = devm_kzalloc(&pdev->dev, sizeof(*data) * priv->num_regulators, |
| 199 | GFP_KERNEL); | 200 | GFP_KERNEL); |
| 200 | if (!data) | 201 | if (!data) { |
| 202 | of_node_put(parent); | ||
| 201 | return NULL; | 203 | return NULL; |
| 204 | } | ||
| 205 | |||
| 202 | p = data; | 206 | p = data; |
| 203 | 207 | ||
| 204 | for_each_child_of_node(parent, child) { | 208 | for_each_child_of_node(parent, child) { |
| @@ -217,6 +221,7 @@ struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt( | |||
| 217 | } | 221 | } |
| 218 | } | 222 | } |
| 219 | } | 223 | } |
| 224 | of_node_put(parent); | ||
| 220 | 225 | ||
| 221 | *num_parsed = parsed; | 226 | *num_parsed = parsed; |
| 222 | return data; | 227 | return data; |
diff --git a/drivers/regulator/pal | |||
