[PATCH] tools/power/x86/intel-speed-select: Fix the wrong format specifier

liujing posted 1 patch 2 days, 14 hours ago
[PATCH] tools/power/x86/intel-speed-select: Fix the wrong format specifier
Posted by liujing 2 days, 14 hours ago
Because clos_config->clos_min and clos_config->clos_max
are unsigned int types, the output format should be %u.

Signed-off-by: liujing <liujing@cmss.chinamobile.com>

diff --git a/tools/power/x86/intel-speed-select/isst-display.c b/tools/power/x86/intel-speed-select/isst-display.c
index 07ebd08f3202..5ecf24bda6dd 100644
--- a/tools/power/x86/intel-speed-select/isst-display.c
+++ b/tools/power/x86/intel-speed-select/isst-display.c
@@ -617,14 +617,14 @@ void isst_clos_display_information(struct isst_id *id, FILE *outf, int clos,
 	format_and_print(outf, level + 2, header, value);
 
 	snprintf(header, sizeof(header), "clos-min");
-	snprintf(value, sizeof(value), "%d MHz", clos_config->clos_min * isst_get_disp_freq_multiplier());
+	snprintf(value, sizeof(value), "%u MHz", clos_config->clos_min * isst_get_disp_freq_multiplier());
 	format_and_print(outf, level + 2, header, value);
 
 	snprintf(header, sizeof(header), "clos-max");
 	if ((clos_config->clos_max * isst_get_disp_freq_multiplier()) == 25500)
 		snprintf(value, sizeof(value), "Max Turbo frequency");
 	else
-		snprintf(value, sizeof(value), "%d MHz", clos_config->clos_max * isst_get_disp_freq_multiplier());
+		snprintf(value, sizeof(value), "%u MHz", clos_config->clos_max * isst_get_disp_freq_multiplier());
 	format_and_print(outf, level + 2, header, value);
 
 	snprintf(header, sizeof(header), "clos-desired");
-- 
2.27.0
Re: [PATCH] tools/power/x86/intel-speed-select: Fix the wrong format specifier
Posted by srinivas pandruvada 2 days, 10 hours ago
On Thu, 2024-11-21 at 21:00 +0800, liujing wrote:
> Because clos_config->clos_min and clos_config->clos_max
> are unsigned int types, the output format should be %u.
> 
> Signed-off-by: liujing <liujing@cmss.chinamobile.com>

You need to have for your tag:

Full Name <email address>

Thanks,
Srinivas

> 
> diff --git a/tools/power/x86/intel-speed-select/isst-display.c
> b/tools/power/x86/intel-speed-select/isst-display.c
> index 07ebd08f3202..5ecf24bda6dd 100644
> --- a/tools/power/x86/intel-speed-select/isst-display.c
> +++ b/tools/power/x86/intel-speed-select/isst-display.c
> @@ -617,14 +617,14 @@ void isst_clos_display_information(struct
> isst_id *id, FILE *outf, int clos,
>  	format_and_print(outf, level + 2, header, value);
>  
>  	snprintf(header, sizeof(header), "clos-min");
> -	snprintf(value, sizeof(value), "%d MHz", clos_config-
> >clos_min * isst_get_disp_freq_multiplier());
> +	snprintf(value, sizeof(value), "%u MHz", clos_config-
> >clos_min * isst_get_disp_freq_multiplier());
>  	format_and_print(outf, level + 2, header, value);
>  
>  	snprintf(header, sizeof(header), "clos-max");
>  	if ((clos_config->clos_max *
> isst_get_disp_freq_multiplier()) == 25500)
>  		snprintf(value, sizeof(value), "Max Turbo
> frequency");
>  	else
> -		snprintf(value, sizeof(value), "%d MHz",
> clos_config->clos_max * isst_get_disp_freq_multiplier());
> +		snprintf(value, sizeof(value), "%u MHz",
> clos_config->clos_max * isst_get_disp_freq_multiplier());
>  	format_and_print(outf, level + 2, header, value);
>  
>  	snprintf(header, sizeof(header), "clos-desired");