]> Git Repo - linux.git/blobdiff - drivers/base/cacheinfo.c
net/sched: Retire dsmark qdisc
[linux.git] / drivers / base / cacheinfo.c
index 4b5cd08c5a657f7341d13dd652a2689230942632..950b22cdb5f7cd81eaff4a3a4deec716c0dc9fee 100644 (file)
@@ -196,7 +196,7 @@ static void cache_of_set_props(struct cacheinfo *this_leaf,
 
 static int cache_setup_of_node(unsigned int cpu)
 {
-       struct device_node *np;
+       struct device_node *np, *prev;
        struct cacheinfo *this_leaf;
        unsigned int index = 0;
 
@@ -206,19 +206,24 @@ static int cache_setup_of_node(unsigned int cpu)
                return -ENOENT;
        }
 
+       prev = np;
+
        while (index < cache_leaves(cpu)) {
                this_leaf = per_cpu_cacheinfo_idx(cpu, index);
-               if (this_leaf->level != 1)
+               if (this_leaf->level != 1) {
                        np = of_find_next_cache_node(np);
-               else
-                       np = of_node_get(np);/* cpu node itself */
-               if (!np)
-                       break;
+                       of_node_put(prev);
+                       prev = np;
+                       if (!np)
+                               break;
+               }
                cache_of_set_props(this_leaf, np);
                this_leaf->fw_token = np;
                index++;
        }
 
+       of_node_put(np);
+
        if (index != cache_leaves(cpu)) /* not all OF nodes populated */
                return -ENOENT;
 
@@ -312,8 +317,6 @@ static void cache_shared_cpu_map_remove(unsigned int cpu)
                        cpumask_clear_cpu(cpu, &sib_leaf->shared_cpu_map);
                        cpumask_clear_cpu(sibling, &this_leaf->shared_cpu_map);
                }
-               if (of_have_populated_dt())
-                       of_node_put(this_leaf->fw_token);
        }
 }
 
This page took 0.034256 seconds and 4 git commands to generate.