diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-01-27 08:16:56 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-01-30 05:50:27 -0500 |
commit | c92f5dd2c42fa61e0ef810fad4584b184ea2d50e (patch) | |
tree | c0d7f598b23259342ea4e912607156fb7acef2d2 /drivers/regulator/max8997.c | |
parent | 9c9588a7326bdebf49f5d205dd4243c0d1df73d5 (diff) |
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, | |||
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; |