diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2024-09-24 13:21:52 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2024-09-30 01:11:43 +0200 |
commit | 7368e9f4e25bea507895bf194bd1c72d693840b2 (patch) | |
tree | 1174926f6c46963f591f96c9957d2fcd2e8f40d8 /drivers/regulator | |
parent | f4e06afb0b47eb8ef6aa42eb8df2adb73b397bf7 (diff) | |
download | lwn-7368e9f4e25bea507895bf194bd1c72d693840b2.tar.gz lwn-7368e9f4e25bea507895bf194bd1c72d693840b2.zip |
regulator: Call of_node_put() only once in rzg2l_usb_vbus_regulator_probe()
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>
Link: https://patch.msgid.link/f9d7a026-a67a-4164-80f4-578b1fbf71ac@web.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/renesas-usb-vbus-regulator.c | 7 |
1 files 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; } |