[PATCH] opal: mem_info: reduce scope of some variables

Colin King colin.king at canonical.com
Tue Jan 24 12:27:18 UTC 2017


From: Colin Ian King <colin.king at canonical.com>

clean up some cppcheck style warnings by reducing scope of some
variables.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/opal/mem_info.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/opal/mem_info.c b/src/opal/mem_info.c
index 6cc0fd9..2b20f80 100644
--- a/src/opal/mem_info.c
+++ b/src/opal/mem_info.c
@@ -32,12 +32,14 @@ static int get_dimm_property(fwts_framework *fw,
 			bool hex,
 			char *property)
 {
-	int node, prop_len, failures = 0;
-	const char *prop_buf;
+	int failures = 0;
 	char *prop_string = strstr(my_path, "/memory-buffer");
 
 	if (prop_string) {
-		node = fdt_path_offset(fw->fdt, prop_string);
+		const char *prop_buf;
+		int prop_len;
+		int node = fdt_path_offset(fw->fdt, prop_string);
+
 		if (node >= 0) {
 			prop_buf = fdt_getprop(fw->fdt, node,
 					property,
-- 
2.10.2




More information about the fwts-devel mailing list