diff mbox series

drivers: video: logo: use %u format specifier for unsigned int values

Message ID 20231219151436.368696-1-colin.i.king@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series drivers: video: logo: use %u format specifier for unsigned int values | expand

Commit Message

Colin Ian King Dec. 19, 2023, 3:14 p.m. UTC
Currently the %d format specifier is being used for unsigned int values.
Fix this by using the correct %u format specifier. Cleans up cppcheck
warnings:

warning: %d in format string (no. 1) requires 'int' but the argument
type is 'unsigned int'. [invalidPrintfArgType_sint]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/video/logo/pnmtologo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Randy Dunlap Dec. 19, 2023, 9:51 p.m. UTC | #1
On 12/19/23 07:14, Colin Ian King wrote:
> Currently the %d format specifier is being used for unsigned int values.
> Fix this by using the correct %u format specifier. Cleans up cppcheck
> warnings:
> 
> warning: %d in format string (no. 1) requires 'int' but the argument
> type is 'unsigned int'. [invalidPrintfArgType_sint]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Thanks.

> ---
>  drivers/video/logo/pnmtologo.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/video/logo/pnmtologo.c b/drivers/video/logo/pnmtologo.c
> index ada5ef6e51b7..2434a25afb64 100644
> --- a/drivers/video/logo/pnmtologo.c
> +++ b/drivers/video/logo/pnmtologo.c
> @@ -249,10 +249,10 @@ static void write_footer(void)
>  	fputs("\n};\n\n", out);
>  	fprintf(out, "const struct linux_logo %s __initconst = {\n", logoname);
>  	fprintf(out, "\t.type\t\t= %s,\n", logo_types[logo_type]);
> -	fprintf(out, "\t.width\t\t= %d,\n", logo_width);
> -	fprintf(out, "\t.height\t\t= %d,\n", logo_height);
> +	fprintf(out, "\t.width\t\t= %u,\n", logo_width);
> +	fprintf(out, "\t.height\t\t= %u,\n", logo_height);
>  	if (logo_type == LINUX_LOGO_CLUT224) {
> -		fprintf(out, "\t.clutsize\t= %d,\n", logo_clutsize);
> +		fprintf(out, "\t.clutsize\t= %u,\n", logo_clutsize);
>  		fprintf(out, "\t.clut\t\t= %s_clut,\n", logoname);
>  	}
>  	fprintf(out, "\t.data\t\t= %s_data\n", logoname);
diff mbox series

Patch

diff --git a/drivers/video/logo/pnmtologo.c b/drivers/video/logo/pnmtologo.c
index ada5ef6e51b7..2434a25afb64 100644
--- a/drivers/video/logo/pnmtologo.c
+++ b/drivers/video/logo/pnmtologo.c
@@ -249,10 +249,10 @@  static void write_footer(void)
 	fputs("\n};\n\n", out);
 	fprintf(out, "const struct linux_logo %s __initconst = {\n", logoname);
 	fprintf(out, "\t.type\t\t= %s,\n", logo_types[logo_type]);
-	fprintf(out, "\t.width\t\t= %d,\n", logo_width);
-	fprintf(out, "\t.height\t\t= %d,\n", logo_height);
+	fprintf(out, "\t.width\t\t= %u,\n", logo_width);
+	fprintf(out, "\t.height\t\t= %u,\n", logo_height);
 	if (logo_type == LINUX_LOGO_CLUT224) {
-		fprintf(out, "\t.clutsize\t= %d,\n", logo_clutsize);
+		fprintf(out, "\t.clutsize\t= %u,\n", logo_clutsize);
 		fprintf(out, "\t.clut\t\t= %s_clut,\n", logoname);
 	}
 	fprintf(out, "\t.data\t\t= %s_data\n", logoname);