Skip to contentSkip to conversation

regulator: s5m8767: Fix reference count leak

PATCH In review Pan Bian 3 participants 3 messages Jan 21, 2021

Subsystems (3)
lore
Share & tools
lore

Pan Bian

author
#0 lore raw

PATCH 1/1 regulator: s5m8767: Fix reference count leak

Call of_node_put() to drop references of regulators_np and reg_np before returning error code.

Fixes 9ae5cc75ceaa ("regulator: s5m8767: Pass descriptor instead of GPIO number")
---
 drivers/regulator/s5m8767.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/regulator/s5m8767.c +5 -2
index 3fa472127e9a..48dd95b3ff45 100644
@@ -573,10 +573,13 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
 			"s5m8767,pmic-ext-control",
 			GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE,
 			"s5m8767");
-		if (PTR_ERR(rdata->ext_control_gpiod) == -ENOENT)
+		if (PTR_ERR(rdata->ext_control_gpiod) == -ENOENT) {
 			rdata->ext_control_gpiod = NULL;
-		else if (IS_ERR(rdata->ext_control_gpiod))
+		} else if (IS_ERR(rdata->ext_control_gpiod)) {
+			of_node_put(reg_np);
+			of_node_put(regulators_np);
 			return PTR_ERR(rdata->ext_control_gpiod);
+		}
 
 		rdata->id = i;
 		rdata->initdata = of_get_regulator_init_data(
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Pan Bian

Call of_node_put() to drop references of regulators_np and reg_np before returning error code.

Fixes 9ae5cc75ceaa ("regulator: s5m8767: Pass descriptor instead of GPIO number")
---
 drivers/regulator/s5m8767.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Best regards,
Krzysztof

maintainer
#2 lore raw
In reply to Pan Bian
Quoted 2 lines · Pan Bian

Call of_node_put() to drop references of regulators_np and reg_np before returning error code.

Applied to

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

Thanks!

[1/1] regulator: s5m8767: Fix reference count leak

      commit: dea6dd2ba63f8c8532addb8f32daf7b89a368a42

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