]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tools/power turbostat: Fix incorrect format variable
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Wed, 11 Mar 2026 09:00:32 +0000 (11:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Apr 2026 11:30:34 +0000 (13:30 +0200)
[ Upstream commit 23cb4f5c81766e70e5f32ed0987ee8fb5ab2e00a ]

In the perf thread, core, and package counter loops, an incorrect
'mp->format' variable is used instead of 'pp->format'.

[lenb: edit commit message]
Fixes: 696d15cbd8c2 ("tools/power turbostat: Refactor floating point printout code")
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/power/x86/turbostat/turbostat.c

index 83a90f413f97680905cadb11a72c40acb67cb928..603651e74dacf632edb8ef218693e84258cccf95 100644 (file)
@@ -3330,7 +3330,7 @@ int format_counters(PER_THREAD_PARAMS)
        for (i = 0, pp = sys.perf_tp; pp; ++i, pp = pp->next) {
                if (pp->format == FORMAT_RAW)
                        outp += print_hex_value(pp->width, &printed, delim, t->perf_counter[i]);
-               else if (pp->format == FORMAT_DELTA || mp->format == FORMAT_AVERAGE)
+               else if (pp->format == FORMAT_DELTA || pp->format == FORMAT_AVERAGE)
                        outp += print_decimal_value(pp->width, &printed, delim, t->perf_counter[i]);
                else if (pp->format == FORMAT_PERCENT) {
                        if (pp->type == COUNTER_USEC)
@@ -3400,7 +3400,7 @@ int format_counters(PER_THREAD_PARAMS)
        for (i = 0, pp = sys.perf_cp; pp; i++, pp = pp->next) {
                if (pp->format == FORMAT_RAW)
                        outp += print_hex_value(pp->width, &printed, delim, c->perf_counter[i]);
-               else if (pp->format == FORMAT_DELTA || mp->format == FORMAT_AVERAGE)
+               else if (pp->format == FORMAT_DELTA || pp->format == FORMAT_AVERAGE)
                        outp += print_decimal_value(pp->width, &printed, delim, c->perf_counter[i]);
                else if (pp->format == FORMAT_PERCENT)
                        outp += print_float_value(&printed, delim, pct(c->perf_counter[i], tsc));
@@ -3558,7 +3558,7 @@ int format_counters(PER_THREAD_PARAMS)
                        outp += print_hex_value(pp->width, &printed, delim, p->perf_counter[i]);
                else if (pp->type == COUNTER_K2M)
                        outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), (unsigned int)p->perf_counter[i] / 1000);
-               else if (pp->format == FORMAT_DELTA || mp->format == FORMAT_AVERAGE)
+               else if (pp->format == FORMAT_DELTA || pp->format == FORMAT_AVERAGE)
                        outp += print_decimal_value(pp->width, &printed, delim, p->perf_counter[i]);
                else if (pp->format == FORMAT_PERCENT)
                        outp += print_float_value(&printed, delim, pct(p->perf_counter[i], tsc));