Skip to contentSkip to conversation

regulator: pfuze100: Fix refcount leak in pfuze_parse_regulators_dt

PATCH In review Miaoqian Lin 2 participants 2 messages May 11, 2022 Voltage and current regulator framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regulator: pfuze100: Fix refcount leak in pfuze_parse_regulators_dt

of_node_get() returns a node with refcount incremented. Calling of_node_put() to drop the reference when not needed anymore.

Fixes 3784b6d64dc5 ("regulator: pfuze100: add pfuze100 regulator driver")
---
 drivers/regulator/pfuze100-regulator.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/pfuze100-regulator.c +2 -0
index d60d7d1b7fa2..aa55cfca9e40 100644
@@ -521,6 +521,7 @@ static int pfuze_parse_regulators_dt(struct pfuze_chip *chip)
 	parent = of_get_child_by_name(np, "regulators");
 	if (!parent) {
 		dev_err(dev, "regulators node not found\n");
+		of_node_put(np);
 		return -EINVAL;
 	}
 
@@ -550,6 +551,7 @@ static int pfuze_parse_regulators_dt(struct pfuze_chip *chip)
 	}
 
 	of_node_put(parent);
+	of_node_put(np);
 	if (ret < 0) {
 		dev_err(dev, "Error parsing regulator init data: %d\n",
 			ret);
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 4 lines · Miaoqian Lin

of_node_get() returns a node with refcount incremented. Calling of_node_put() to drop the reference when not needed anymore.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: pfuze100: Fix refcount leak in pfuze_parse_regulators_dt

      commit: afaa7b933ef00a2d3262f4d1252087613fb5c06d

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark