Commit d4cd75b8 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Mark Brown

regulator: qcom-smd: 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: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240814-cleanup-h-of-node-put-regulator-v1-6-87151088b883@linaro.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 17636d44
...@@ -1435,7 +1435,6 @@ static int rpm_reg_probe(struct platform_device *pdev) ...@@ -1435,7 +1435,6 @@ static int rpm_reg_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const struct rpm_regulator_data *vreg_data; const struct rpm_regulator_data *vreg_data;
struct device_node *node;
struct qcom_rpm_reg *vreg; struct qcom_rpm_reg *vreg;
struct qcom_smd_rpm *rpm; struct qcom_smd_rpm *rpm;
int ret; int ret;
...@@ -1455,19 +1454,15 @@ static int rpm_reg_probe(struct platform_device *pdev) ...@@ -1455,19 +1454,15 @@ static int rpm_reg_probe(struct platform_device *pdev)
if (!vreg_data) if (!vreg_data)
return -ENODEV; return -ENODEV;
for_each_available_child_of_node(dev->of_node, node) { for_each_available_child_of_node_scoped(dev->of_node, node) {
vreg = devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); vreg = devm_kzalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL);
if (!vreg) { if (!vreg)
of_node_put(node);
return -ENOMEM; return -ENOMEM;
}
ret = rpm_regulator_init_vreg(vreg, dev, node, vreg_data); ret = rpm_regulator_init_vreg(vreg, dev, node, vreg_data);
if (ret < 0) { if (ret < 0)
of_node_put(node);
return ret; return ret;
} }
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment