]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: nx - Simplify with scoped for each OF child loop
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Fri, 2 Jan 2026 12:50:12 +0000 (13:50 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 23 Jan 2026 05:48:44 +0000 (13:48 +0800)
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/nx/nx-common-powernv.c

index 0493041ea08851725eb67f9e2fbfe0fb8e34c9ad..56aa1c29d7827235902a43c491f443b14df64b5b 100644 (file)
@@ -908,7 +908,6 @@ static int __init nx_powernv_probe_vas(struct device_node *pn)
 {
        int chip_id, vasid, ret = 0;
        int ct_842 = 0, ct_gzip = 0;
-       struct device_node *dn;
 
        chip_id = of_get_ibm_chip_id(pn);
        if (chip_id < 0) {
@@ -922,7 +921,7 @@ static int __init nx_powernv_probe_vas(struct device_node *pn)
                return -EINVAL;
        }
 
-       for_each_child_of_node(pn, dn) {
+       for_each_child_of_node_scoped(pn, dn) {
                ret = find_nx_device_tree(dn, chip_id, vasid, NX_CT_842,
                                        "ibm,p9-nx-842", &ct_842);
 
@@ -930,10 +929,8 @@ static int __init nx_powernv_probe_vas(struct device_node *pn)
                        ret = find_nx_device_tree(dn, chip_id, vasid,
                                NX_CT_GZIP, "ibm,p9-nx-gzip", &ct_gzip);
 
-               if (ret) {
-                       of_node_put(dn);
+               if (ret)
                        return ret;
-               }
        }
 
        if (!ct_842 || !ct_gzip) {