[prev in list] [next in list] [prev in thread] [next in thread]
List: fwts-devel
Subject: ACK: [PATCH] opal: reduce scope of variable 'prop_buf'
From: ivanhu <ivan.hu () canonical ! com>
Date: 2017-02-22 9:53:52
Message-ID: e0d34a82-c233-06d4-8087-1d6c92413739 () canonical ! com
[Download RAW message or body]
On 02/20/2017 06:09 AM, Colin King wrote:
> From: Colin Ian King <colin.king@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@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);
>
Acked-by: Ivan Hu <ivan.hu@canonical.com>
--
fwts-devel mailing list
fwts-devel@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/fwts-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic