[PATCH] fs/afs: Remove unnecessary integer promotion in format strings

Dipendra Khadka kdipendra88 at gmail.com
Fri Jan 2 03:57:40 PST 2026


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 at 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




More information about the linux-afs mailing list