From c92f5dd2c42fa61e0ef810fad4584b184ea2d50e Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sun, 27 Jan 2013 21:16:56 +0800 Subject: 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 Signed-off-by: Mark Brown --- drivers/regulator/max8925-regulator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/regulator/max8925-regulator.c') diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index 446a8544555..0d5f64a805a 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, { struct device_node *nproot, *np; int rcount; - nproot = pdev->dev.parent->of_node; + nproot = of_node_get(pdev->dev.parent->of_node); if (!nproot) return -ENODEV; np = of_find_node_by_name(nproot, "regulators"); @@ -263,6 +263,7 @@ static int max8925_regulator_dt_init(struct platform_device *pdev, rcount = of_regulator_match(&pdev->dev, np, &max8925_regulator_matches[ridx], 1); + of_node_put(np); if (rcount < 0) return -ENODEV; config->init_data = max8925_regulator_matches[ridx].init_data; -- cgit v1.2.3-70-g09d2