mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regulator: Call of_node_put() only once in rzg2l_usb_vbus_regulator_probe()
@ 2024-09-24 11:34 Markus Elfring
  2024-09-24 11:51 ` Biju Das
  2024-09-30 20:37 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Markus Elfring @ 2024-09-24 11:34 UTC (permalink / raw)
  To: kernel-janitors, Biju Das, Liam Girdwood, Mark Brown
  Cc: LKML, Krzysztof Kozlowski

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 24 Sep 2024 13:21:52 +0200

An of_node_put(config.of_node) call was immediately used after a pointer
check for a devm_regulator_register() call in this function implementation.
Thus call such a function only once instead directly before the check.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/regulator/renesas-usb-vbus-regulator.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/regulator/renesas-usb-vbus-regulator.c b/drivers/regulator/renesas-usb-vbus-regulator.c
index 4eceb6b54497..dec7cac5e8d5 100644
--- a/drivers/regulator/renesas-usb-vbus-regulator.c
+++ b/drivers/regulator/renesas-usb-vbus-regulator.c
@@ -49,13 +49,10 @@ static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, -ENODEV, "regulator node not found\n");

 	rdev = devm_regulator_register(dev, &rzg2l_usb_vbus_rdesc, &config);
-	if (IS_ERR(rdev)) {
-		of_node_put(config.of_node);
+	of_node_put(config.of_node);
+	if (IS_ERR(rdev))
 		return dev_err_probe(dev, PTR_ERR(rdev),
 				     "not able to register vbus regulator\n");
-	}
-
-	of_node_put(config.of_node);

 	return 0;
 }
--
2.46.1


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

* RE: [PATCH] regulator: Call of_node_put() only once in rzg2l_usb_vbus_regulator_probe()
  2024-09-24 11:34 [PATCH] regulator: Call of_node_put() only once in rzg2l_usb_vbus_regulator_probe() Markus Elfring
@ 2024-09-24 11:51 ` Biju Das
  2024-09-30 20:37 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Biju Das @ 2024-09-24 11:51 UTC (permalink / raw)
  To: Markus Elfring, kernel-janitors, Liam Girdwood, Mark Brown
  Cc: LKML, Krzysztof Kozlowski

Hi Markus Elfring,

Thanks for the patch.

> -----Original Message-----
> From: Markus Elfring <Markus.Elfring@web.de>
> Sent: Tuesday, September 24, 2024 12:35 PM
> Subject: [PATCH] regulator: Call of_node_put() only once in rzg2l_usb_vbus_regulator_probe()
> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 24 Sep 2024 13:21:52 +0200
> 
> An of_node_put(config.of_node) call was immediately used after a pointer check for a
> devm_regulator_register() call in this function implementation.
> Thus call such a function only once instead directly before the check.
> 
> This issue was transformed by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

Cheers,
Biju

> ---
>  drivers/regulator/renesas-usb-vbus-regulator.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/regulator/renesas-usb-vbus-regulator.c b/drivers/regulator/renesas-usb-vbus-
> regulator.c
> index 4eceb6b54497..dec7cac5e8d5 100644
> --- a/drivers/regulator/renesas-usb-vbus-regulator.c
> +++ b/drivers/regulator/renesas-usb-vbus-regulator.c
> @@ -49,13 +49,10 @@ static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev)
>  		return dev_err_probe(dev, -ENODEV, "regulator node not found\n");
> 
>  	rdev = devm_regulator_register(dev, &rzg2l_usb_vbus_rdesc, &config);
> -	if (IS_ERR(rdev)) {
> -		of_node_put(config.of_node);
> +	of_node_put(config.of_node);
> +	if (IS_ERR(rdev))
>  		return dev_err_probe(dev, PTR_ERR(rdev),
>  				     "not able to register vbus regulator\n");
> -	}
> -
> -	of_node_put(config.of_node);
> 
>  	return 0;
>  }
> --
> 2.46.1


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

* Re: [PATCH] regulator: Call of_node_put() only once in rzg2l_usb_vbus_regulator_probe()
  2024-09-24 11:34 [PATCH] regulator: Call of_node_put() only once in rzg2l_usb_vbus_regulator_probe() Markus Elfring
  2024-09-24 11:51 ` Biju Das
@ 2024-09-30 20:37 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2024-09-30 20:37 UTC (permalink / raw)
  To: kernel-janitors, Biju Das, Liam Girdwood, Markus Elfring
  Cc: LKML, Krzysztof Kozlowski

On Tue, 24 Sep 2024 13:34:45 +0200, Markus Elfring wrote:
> An of_node_put(config.of_node) call was immediately used after a pointer
> check for a devm_regulator_register() call in this function implementation.
> Thus call such a function only once instead directly before the check.
> 
> This issue was transformed by using the Coccinelle software.
> 
> 
> [...]

Applied to

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

Thanks!

[1/1] regulator: Call of_node_put() only once in rzg2l_usb_vbus_regulator_probe()
      commit: 7368e9f4e25bea507895bf194bd1c72d693840b2

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:[~2024-09-30 20:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-24 11:34 [PATCH] regulator: Call of_node_put() only once in rzg2l_usb_vbus_regulator_probe() Markus Elfring
2024-09-24 11:51 ` Biju Das
2024-09-30 20:37 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®