Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: scmi: Simplify with scoped for each OF child loop

Use scoped for_each_available_child_of_node_scoped() when iterating over
device nodes to make code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240814-cleanup-h-of-node-put-regulator-v1-7-87151088b883@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Mark Brown
99cf5db9 d4cd75b8

+3 -5
+3 -5
drivers/regulator/scmi-regulator.c
··· 297 297 static int scmi_regulator_probe(struct scmi_device *sdev) 298 298 { 299 299 int d, ret, num_doms; 300 - struct device_node *np, *child; 300 + struct device_node *np; 301 301 const struct scmi_handle *handle = sdev->handle; 302 302 struct scmi_regulator_info *rinfo; 303 303 struct scmi_protocol_handle *ph; ··· 341 341 */ 342 342 of_node_get(handle->dev->of_node); 343 343 np = of_find_node_by_name(handle->dev->of_node, "regulators"); 344 - for_each_child_of_node(np, child) { 344 + for_each_child_of_node_scoped(np, child) { 345 345 ret = process_scmi_regulator_of_node(sdev, ph, child, rinfo); 346 346 /* abort on any mem issue */ 347 - if (ret == -ENOMEM) { 348 - of_node_put(child); 347 + if (ret == -ENOMEM) 349 348 return ret; 350 - } 351 349 } 352 350 of_node_put(np); 353 351 /*