diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-09-13 07:27:58 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-05 16:02:50 +0100 |
| commit | 1c4770fd18a859de432bc39e3af3df0c0ef6c332 (patch) | |
| tree | 5aa844185fad22ea07b108cf1877266d0f48a112 | |
| parent | 5876d0ade10d53abe4e9c6666c5117ca73a211f6 (diff) | |
| download | farga-1c4770fd18a859de432bc39e3af3df0c0ef6c332.tar.gz farga-1c4770fd18a859de432bc39e3af3df0c0ef6c332.zip | |
kernel/dtm: ensure that the cpu node is released
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
| -rw-r--r-- | kernel/dtm/dtm.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/kernel/dtm/dtm.c b/kernel/dtm/dtm.c index adda89a..e5f7f50 100644 --- a/kernel/dtm/dtm.c +++ b/kernel/dtm/dtm.c @@ -48,8 +48,6 @@ static int __init dtm_init(void) * Kernel which allows `cpu` to be an iterator over CPU device nodes. */ for_each_possible_cpu(cpu) { - /* isa = NULL; */ - /* * Given a CPU identifier, `of_cpu_device_node_get` returns a `struct * device_node` related to the specified CPU (or NULL on error). @@ -66,7 +64,7 @@ static int __init dtm_init(void) */ if (!of_property_present(node, "riscv,isa")) { pr_warn("Unable to find 'riscv,isa' for this node\n"); - continue; + goto release_cpu_node; } /* @@ -79,7 +77,7 @@ static int __init dtm_init(void) rc = of_property_read_string(node, "riscv,isa", &isa); if (rc) { pr_warn("Unable to find \"riscv,isa\" devicetree entry\n"); - continue; + goto release_cpu_node; } pr_info("RISC-V ISA for '%s': %s\n", node->full_name, isa); @@ -90,7 +88,7 @@ static int __init dtm_init(void) parent = of_get_parent(node); if (!node) { pr_warn("No parent for the given node!\n"); - continue; + goto release_cpu_node; } pr_info("parent: %s\n", node->full_name); @@ -99,8 +97,9 @@ static int __init dtm_init(void) * nodes. We are done using these instances, so we should decrement * their life times. */ - of_node_put(node); of_node_put(parent); +release_cpu_node: + of_node_put(node); } return 0; } |
