public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs/afs: Remove unnecessary integer promotion in format strings
@ 2026-01-02 11:57 Dipendra Khadka
  2026-01-02 22:40 ` David Laight
  0 siblings, 1 reply; 3+ messages in thread
From: Dipendra Khadka @ 2026-01-02 11:57 UTC (permalink / raw)
  To: dhowells, marc.dionne; +Cc: linux-afs, linux-kernel, kdipendra88

Remove 'h' length modifier from printk format strings where integer
promotion makes it redundant. When short integers are passed to
variadic functions like pr_notice(), they are automatically promoted
to int, making the 'h' modifier unnecessary.

This addresses checkpatch warnings:
  WARNING: Integer promotion: Using 'h' in '%hd' is unnecessary
  WARNING: Integer promotion: Using 'h' in '%hx' is unnecessary
  WARNING: Integer promotion: Using 'h' in '%hu' is unnecessary

Changes:
- fs/afs/rotate.c: %hd → %d, %hx → %x
- fs/afs/vl_rotate.c: %hu → %u, %hx → %x, %hd → %d

Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
---
 fs/afs/rotate.c    | 4 ++--
 fs/afs/vl_rotate.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/afs/rotate.c b/fs/afs/rotate.c
index 6a4e7da10fc4..9c8dc6911b9b 100644
--- a/fs/afs/rotate.c
+++ b/fs/afs/rotate.c
@@ -724,7 +724,7 @@ void afs_dump_edestaddrreq(const struct afs_operation *op)
 	rcu_read_lock();
 
 	pr_notice("EDESTADDR occurred\n");
-	pr_notice("OP: cbb=%x cbb2=%x fl=%x err=%hd\n",
+	pr_notice("OP: cbb=%x cbb2=%x fl=%x err=%d\n",
 		  op->file[0].cb_break_before,
 		  op->file[1].cb_break_before, op->flags, op->cumul_error.error);
 	pr_notice("OP: ut=%lx ix=%d ni=%u\n",
@@ -735,7 +735,7 @@ void afs_dump_edestaddrreq(const struct afs_operation *op)
 	if (op->server_list) {
 		const struct afs_server_list *sl = op->server_list;
 
-		pr_notice("FC: SL nr=%u vnov=%hx\n",
+		pr_notice("FC: SL nr=%u vnov=%x\n",
 			  sl->nr_servers, sl->vnovol_mask);
 		for (i = 0; i < sl->nr_servers; i++) {
 			const struct afs_server *s = sl->servers[i].server;
diff --git a/fs/afs/vl_rotate.c b/fs/afs/vl_rotate.c
index 6ad9688d8f4b..fe4d41cb9ba5 100644
--- a/fs/afs/vl_rotate.c
+++ b/fs/afs/vl_rotate.c
@@ -336,7 +336,7 @@ static void afs_vl_dump_edestaddrreq(const struct afs_vl_cursor *vc)
 	pr_notice("CELL: %s err=%d\n", cell->name, cell->error);
 	pr_notice("DNS: src=%u st=%u lc=%x\n",
 		  cell->dns_source, cell->dns_status, cell->dns_lookup_count);
-	pr_notice("VC: ut=%lx ix=%u ni=%hu fl=%hx err=%hd\n",
+	pr_notice("VC: ut=%lx ix=%u ni=%u fl=%x err=%d\n",
 		  vc->untried_servers, vc->server_index, vc->nr_iterations,
 		  vc->flags, vc->cumul_error.error);
 	pr_notice("VC: call  er=%d ac=%d r=%u\n",
@@ -348,7 +348,7 @@ static void afs_vl_dump_edestaddrreq(const struct afs_vl_cursor *vc)
 			  sl->nr_servers, sl->index);
 		for (i = 0; i < sl->nr_servers; i++) {
 			const struct afs_vlserver *s = sl->servers[i].server;
-			pr_notice("VC: server %s+%hu fl=%lx E=%hd\n",
+			pr_notice("VC: server %s+%u fl=%lx E=%d\n",
 				  s->name, s->port, s->flags, s->probe.error);
 			if (s->addresses) {
 				const struct afs_addr_list *a =
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs/afs: Remove unnecessary integer promotion in format strings
  2026-01-02 11:57 [PATCH] fs/afs: Remove unnecessary integer promotion in format strings Dipendra Khadka
@ 2026-01-02 22:40 ` David Laight
  2026-01-03  9:05   ` Dipendra Khadka
  0 siblings, 1 reply; 3+ messages in thread
From: David Laight @ 2026-01-02 22:40 UTC (permalink / raw)
  To: Dipendra Khadka; +Cc: dhowells, marc.dionne, linux-afs, linux-kernel

On Fri,  2 Jan 2026 11:57:40 +0000
Dipendra Khadka <kdipendra88@gmail.com> wrote:

> Remove 'h' length modifier from printk format strings where integer
> promotion makes it redundant. When short integers are passed to
> variadic functions like pr_notice(), they are automatically promoted
> to int, making the 'h' modifier unnecessary.

Fairly pointless churn for existing code.

The message isn't really right either, 'short integers' are always
promoted to 'int' whenever they are used.
There is nothing special about variadic functions.

	David

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs/afs: Remove unnecessary integer promotion in format strings
  2026-01-02 22:40 ` David Laight
@ 2026-01-03  9:05   ` Dipendra Khadka
  0 siblings, 0 replies; 3+ messages in thread
From: Dipendra Khadka @ 2026-01-03  9:05 UTC (permalink / raw)
  To: david.laight.linux
  Cc: dhowells, kdipendra88, linux-afs, linux-kernel, marc.dionne

>Fairly pointless churn for existing code.
>
>The message isn't really right either, 'short integers' are always
>promoted to 'int' whenever they are used.
>There is nothing special about variadic functions.

Yeah , I accept that but this patch is for consistency.
Other subsytems are migrating. There are very small 
printk statements with "%hd","%hx" and "%hu".

root@ubuntu:/home/ubuntu/linux# git grep "%hd" . | wc -l
48
root@ubuntu:/home/ubuntu/linux# git log --oneline 
b69053dd3ffb (HEAD -> master, origin/master, origin/HEAD) wifi: mt76: Remove blank line after mt792x firmware version dmesg
af7809f037e6 Revert "wifi: mt76: Strip whitespace from build ddate"
9528d5c091c5 Merge tag 'platform-drivers-x86-v6.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
349bd28a86f2 Merge tag 'vfio-v6.19-rc4' of https://github.com/awilliam/linux-vfio


Best Regards,
Dipendra


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-03  9:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-02 11:57 [PATCH] fs/afs: Remove unnecessary integer promotion in format strings Dipendra Khadka
2026-01-02 22:40 ` David Laight
2026-01-03  9:05   ` Dipendra Khadka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox