Skip to content

Commit 7368e9f

Browse files
elfringbroonie
authored andcommitted
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent f4e06af commit 7368e9f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/regulator/renesas-usb-vbus-regulator.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,10 @@ static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev)
4949
return dev_err_probe(dev, -ENODEV, "regulator node not found\n");
5050

5151
rdev = devm_regulator_register(dev, &rzg2l_usb_vbus_rdesc, &config);
52-
if (IS_ERR(rdev)) {
53-
of_node_put(config.of_node);
52+
of_node_put(config.of_node);
53+
if (IS_ERR(rdev))
5454
return dev_err_probe(dev, PTR_ERR(rdev),
5555
"not able to register vbus regulator\n");
56-
}
57-
58-
of_node_put(config.of_node);
5956

6057
return 0;
6158
}

0 commit comments

Comments
 (0)