linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: s5m8767: Fix reference count leak
@ 2021-01-21  3:27 Pan Bian
  2021-01-21 15:54 ` Krzysztof Kozlowski
  2021-01-21 19:40 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Pan Bian @ 2021-01-21  3:27 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz, Liam Girdwood,
	Mark Brown, Linus Walleij, Lee Jones
  Cc: linux-kernel, linux-samsung-soc, 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")
Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/regulator/s5m8767.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 3fa472127e9a..48dd95b3ff45 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -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(
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: s5m8767: Fix reference count leak
  2021-01-21  3:27 [PATCH] regulator: s5m8767: Fix reference count leak Pan Bian
@ 2021-01-21 15:54 ` Krzysztof Kozlowski
  2021-01-21 19:40 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2021-01-21 15:54 UTC (permalink / raw)
  To: Pan Bian
  Cc: Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Linus Walleij, Lee Jones, linux-kernel, linux-samsung-soc

On Wed, Jan 20, 2021 at 07:27:56PM -0800, Pan Bian wrote:
> 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")
> Signed-off-by: Pan Bian <bianpan2016@163.com>
> ---
>  drivers/regulator/s5m8767.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: s5m8767: Fix reference count leak
  2021-01-21  3:27 [PATCH] regulator: s5m8767: Fix reference count leak Pan Bian
  2021-01-21 15:54 ` Krzysztof Kozlowski
@ 2021-01-21 19:40 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-01-21 19:40 UTC (permalink / raw)
  To: Linus Walleij, Krzysztof Kozlowski, Pan Bian, Liam Girdwood,
	Lee Jones, Bartlomiej Zolnierkiewicz
  Cc: linux-kernel, linux-samsung-soc

On Wed, 20 Jan 2021 19:27:56 -0800, Pan Bian wrote:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-21 19:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21  3:27 [PATCH] regulator: s5m8767: Fix reference count leak Pan Bian
2021-01-21 15:54 ` Krzysztof Kozlowski
2021-01-21 19:40 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).