lkml.org 
[lkml]   [2018]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/4] base/drivers/topology: Move instructions in the error path
Date
When the function topology_parse_cpu_capacity() fails, we set the boolean
cap_parsing_failed to true and we free the raw_capacity. This is correct as
the function begins with a check against cap_parsing_failed thus protecting
the function to be re-entered.

However, even it is impossible that can happen with the current code, let's
move in the instructions:

- cap_parsing_failed = true;
- free_raw_capacity();

... in the 'else' block when the error is detected, that is more semantically
correct.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/base/arch_topology.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index b19d6d4..7311641 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -155,9 +155,9 @@ bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu)
pr_err("cpu_capacity: missing %pOF raw capacity\n",
cpu_node);
pr_err("cpu_capacity: partial information: fallback to 1024 for all CPUs\n");
+ cap_parsing_failed = true;
+ free_raw_capacity();
}
- cap_parsing_failed = true;
- free_raw_capacity();
}

return !ret;
--
2.7.4
\
 
 \ /
  Last update: 2018-10-29 17:24    [W:0.145 / U:1.740 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site