Commit e78bf6be authored by Pan Bian's avatar Pan Bian Committed by Mark Brown

regulator: axp20x: Fix reference cout leak

Decrements the reference count of device node and its child node.

Fixes: dfe7a1b0 ("regulator: AXP20x: Add support for regulators subsystem")
Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
Link: https://lore.kernel.org/r/20210120123313.107640-1-bianpan2016@163.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f35f6d8c
...@@ -1070,7 +1070,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) ...@@ -1070,7 +1070,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
static int axp20x_regulator_parse_dt(struct platform_device *pdev) static int axp20x_regulator_parse_dt(struct platform_device *pdev)
{ {
struct device_node *np, *regulators; struct device_node *np, *regulators;
int ret; int ret = 0;
u32 dcdcfreq = 0; u32 dcdcfreq = 0;
np = of_node_get(pdev->dev.parent->of_node); np = of_node_get(pdev->dev.parent->of_node);
...@@ -1085,13 +1085,12 @@ static int axp20x_regulator_parse_dt(struct platform_device *pdev) ...@@ -1085,13 +1085,12 @@ static int axp20x_regulator_parse_dt(struct platform_device *pdev)
ret = axp20x_set_dcdc_freq(pdev, dcdcfreq); ret = axp20x_set_dcdc_freq(pdev, dcdcfreq);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "Error setting dcdc frequency: %d\n", ret); dev_err(&pdev->dev, "Error setting dcdc frequency: %d\n", ret);
return ret;
} }
of_node_put(regulators); of_node_put(regulators);
} }
return 0; of_node_put(np);
return ret;
} }
static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 workmode) static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 workmode)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment