Thread (2 messages) 2 messages, 2 authors, 2026-01-03

Re: [PATCH] pmdomain: mediatek: Simplify with scoped for each OF child loop

From: Ulf Hansson <hidden>
Date: 2026-01-03 10:03:34
Also in: linux-mediatek, linux-pm, lkml

On Fri, 2 Jan 2026 at 13:48, Krzysztof Kozlowski
[off-list ref] wrote:
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski <redacted>
Applied for next, thanks!

Kind regards
Uffe

quoted hunk ↗ jump to hunk
---
 drivers/pmdomain/mediatek/mtk-pm-domains.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/pmdomain/mediatek/mtk-pm-domains.c b/drivers/pmdomain/mediatek/mtk-pm-domains.c
index 80561d27f2b2..ab2514c78c14 100644
--- a/drivers/pmdomain/mediatek/mtk-pm-domains.c
+++ b/drivers/pmdomain/mediatek/mtk-pm-domains.c
@@ -1191,7 +1191,6 @@ static int scpsys_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct device_node *np = dev->of_node;
        const struct scpsys_soc_data *soc;
-       struct device_node *node;
        struct device *parent;
        struct scpsys *scpsys;
        int num_domains, ret;
@@ -1235,21 +1234,18 @@ static int scpsys_probe(struct platform_device *pdev)
                return ret;

        ret = -ENODEV;
-       for_each_available_child_of_node(np, node) {
+       for_each_available_child_of_node_scoped(np, node) {
                struct generic_pm_domain *domain;

                domain = scpsys_add_one_domain(scpsys, node);
                if (IS_ERR(domain)) {
                        ret = PTR_ERR(domain);
-                       of_node_put(node);
                        goto err_cleanup_domains;
                }

                ret = scpsys_add_subdomain(scpsys, node);
-               if (ret) {
-                       of_node_put(node);
+               if (ret)
                        goto err_cleanup_domains;
-               }
        }

        if (ret) {
--
2.51.0
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help