diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-01-27 17:16:56 +0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-01-30 14:50:27 +0400 |
commit | c92f5dd2c42fa61e0ef810fad4584b184ea2d50e (patch) | |
tree | c0d7f598b23259342ea4e912607156fb7acef2d2 /drivers/regulator/max8997.c | |
parent | 9c9588a7326bdebf49f5d205dd4243c0d1df73d5 (diff) | |
download | linux-c92f5dd2c42fa61e0ef810fad4584b184ea2d50e.tar.xz |
regulator: Add missing of_node_put()
of_find_node_by_name() returns a node pointer with refcount incremented, use
of_node_put() on it when done.
of_find_node_by_name() will call of_node_put() against from parameter,
thus we also need to call of_node_get(from) before calling
of_find_node_by_name().
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/max8997.c')
-rw-r--r-- | drivers/regulator/max8997.c | 4 |
1 files changed, 3 insertions, 1 deletions
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, 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; @@ -980,6 +980,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, 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; } @@ -1002,6 +1003,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; |