[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<TY3PR01MB113467393E246D553D715D3B786682@TY3PR01MB11346.jpnprd01.prod.outlook.com>
Date: Tue, 24 Sep 2024 11:51:40 +0000
From: Biju Das <biju.das.jz@...renesas.com>
To: Markus Elfring <Markus.Elfring@....de>, "kernel-janitors@...r.kernel.org"
<kernel-janitors@...r.kernel.org>, Liam Girdwood <lgirdwood@...il.com>, Mark
Brown <broonie@...nel.org>
CC: LKML <linux-kernel@...r.kernel.org>, Krzysztof Kozlowski
<krzysztof.kozlowski@...aro.org>
Subject: RE: [PATCH] regulator: Call of_node_put() only once in
rzg2l_usb_vbus_regulator_probe()
Hi Markus Elfring,
Thanks for the patch.
> -----Original Message-----
> From: Markus Elfring <Markus.Elfring@....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@...rs.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@...rs.sourceforge.net>
Reviewed-by: Biju Das <biju.das.jz@...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
Powered by blists - more mailing lists