[PATCH 21/46] cpu: msr: reduce scope of variables

Keng-Yu Lin keng-yu.lin at canonical.com
Tue Jan 20 06:56:26 UTC 2015


On Wed, Jan 14, 2015 at 3:04 AM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> cppcheck is picking up some minor style issues which can
> be easily fixed:
>
> [src/cpu/msr/msr.c:123]:
>         (style) The scope of the variable 'cpu' can be reduced.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/cpu/msr/msr.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/cpu/msr/msr.c b/src/cpu/msr/msr.c
> index 0d04007..e2acce3 100644
> --- a/src/cpu/msr/msr.c
> +++ b/src/cpu/msr/msr.c
> @@ -120,7 +120,6 @@ static int msr_consistent_check(fwts_framework *fw,
>         uint64_t *vals;
>         bool *inconsistent;
>         int inconsistent_count;
> -       int cpu;
>
>         if ((vals = calloc(ncpus, sizeof(uint64_t))) == NULL) {
>                 fwts_log_error(fw, "Out of memory allocating msr value buffers.");
> @@ -138,6 +137,8 @@ static int msr_consistent_check(fwts_framework *fw,
>                 return FWTS_ERROR;
>         }
>         if (inconsistent_count > 0) {
> +               int cpu;
> +
>                 fwts_failed(fw, level, "MSRCPUsInconsistent",
>                         "MSR 0x%8.8" PRIx32 " %s has %d inconsistent values across "
>                         "%d CPUs (shift: %d mask: 0x%" PRIx64 ").",
> --
> 2.1.4
>
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>



More information about the fwts-devel mailing list