summaryrefslogtreecommitdiff
path: root/drivers/regulator/max8997.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-02-19 16:42:52 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-02-19 16:42:52 +0400
commitcf1466fbf8274d35a04d63a3f057b67d91afd671 (patch)
treeffe64b4b39c35046fef745439c1f6a3d5cc06ff4 /drivers/regulator/max8997.c
parentc99f21c2763f2071dc09eb4cb26cff866e19a1c5 (diff)
parent86f6673325e38274c55f3df9f919d9a618f100d4 (diff)
downloadlinux-cf1466fbf8274d35a04d63a3f057b67d91afd671.tar.xz
Merge remote-tracking branch 'regulator/topic/of' into regulator-next
Diffstat (limited to 'drivers/regulator/max8997.c')
-rw-r--r--drivers/regulator/max8997.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c
index 5556a15743fd..0ac7a87519b4 100644
--- a/drivers/regulator/max8997.c
+++ b/drivers/regulator/max8997.c
@@ -917,7 +917,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev,
struct max8997_regulator_data *rdata;
unsigned int i, dvs_voltage_nr = 1, ret;
- pmic_np = iodev->dev->of_node;
+ pmic_np = of_node_get(iodev->dev->of_node);
if (!pmic_np) {
dev_err(&pdev->dev, "could not find pmic sub-node\n");
return -ENODEV;
@@ -930,13 +930,12 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev,
}
/* count the number of regulators to be supported in pmic */
- pdata->num_regulators = 0;
- for_each_child_of_node(regulators_np, reg_np)
- pdata->num_regulators++;
+ pdata->num_regulators = of_get_child_count(regulators_np);
rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) *
pdata->num_regulators, GFP_KERNEL);
if (!rdata) {
+ of_node_put(regulators_np);
dev_err(&pdev->dev, "could not allocate memory for regulator data\n");
return -ENOMEM;
}
@@ -959,6 +958,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev,
rdata->reg_node = reg_np;
rdata++;
}
+ of_node_put(regulators_np);
if (of_get_property(pmic_np, "max8997,pmic-buck1-uses-gpio-dvs", NULL))
pdata->buck1_gpiodvs = true;