Skip to content

Commit

Permalink
regulator: axp20x: Fix reference cout leak
Browse files Browse the repository at this point in the history
[ Upstream commit e78bf6b ]

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

Fixes: dfe7a1b ("regulator: AXP20x: Add support for regulators subsystem")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Link: https://lore.kernel.org/r/20210120123313.107640-1-bianpan2016@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
SinkFinder authored and gregkh committed Mar 4, 2021
1 parent edf1d90 commit 8d0c3ac
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/regulator/axp20x-regulator.c
Expand Up @@ -1072,7 +1072,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
static int axp20x_regulator_parse_dt(struct platform_device *pdev)
{
struct device_node *np, *regulators;
int ret;
int ret = 0;
u32 dcdcfreq = 0;

np = of_node_get(pdev->dev.parent->of_node);
Expand All @@ -1087,13 +1087,12 @@ static int axp20x_regulator_parse_dt(struct platform_device *pdev)
ret = axp20x_set_dcdc_freq(pdev, dcdcfreq);
if (ret < 0) {
dev_err(&pdev->dev, "Error setting dcdc frequency: %d\n", ret);
return ret;
}

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)
Expand Down

0 comments on commit 8d0c3ac

Please sign in to comment.