[PATCH] opal: reduce scope of variable 'prop_buf'
Colin King
colin.king at canonical.com
Sun Feb 19 22:09:10 UTC 2017
From: Colin Ian King <colin.king at canonical.com>
cppcheck style checker detected a couple of places where we can
reduce the scope of prop_buf.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/opal/cpu_info.c | 4 +++-
src/opal/mem_info.c | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/opal/cpu_info.c b/src/opal/cpu_info.c
index 603163c..5b3466f 100644
--- a/src/opal/cpu_info.c
+++ b/src/opal/cpu_info.c
@@ -36,10 +36,12 @@ static int get_xscom_property(fwts_framework *fw,
char *prop_string = strstr(my_path, "/xscom");
if (prop_string) {
- const char *prop_buf;
int prop_len;
int node = fdt_path_offset(fw->fdt, prop_string);
+
if (node >= 0) {
+ const char *prop_buf;
+
prop_buf = fdt_getprop(fw->fdt, node,
property,
&prop_len);
diff --git a/src/opal/mem_info.c b/src/opal/mem_info.c
index 2b20f80..7bda7bc 100644
--- a/src/opal/mem_info.c
+++ b/src/opal/mem_info.c
@@ -36,11 +36,12 @@ static int get_dimm_property(fwts_framework *fw,
char *prop_string = strstr(my_path, "/memory-buffer");
if (prop_string) {
- const char *prop_buf;
int prop_len;
int node = fdt_path_offset(fw->fdt, prop_string);
if (node >= 0) {
+ const char *prop_buf;
+
prop_buf = fdt_getprop(fw->fdt, node,
property,
&prop_len);
--
2.10.2
More information about the fwts-devel
mailing list