Skip to content

Commit 71b2569

Browse files
JustinStittmartinkpetersen
authored andcommitted
scsi: target: iscsi: Fix clang -Wformat warnings
When building with Clang we encounter these warnings: | drivers/target/iscsi/iscsi_target_login.c:719:24: error: format | specifies type 'unsigned short' but the argument has type 'int' | [-Werror,-Wformat] " from node: %s\n", atomic_read(&sess->nconn), - | drivers/target/iscsi/iscsi_target_login.c:767:12: error: format | specifies type 'unsigned short' but the argument has type 'int' | [-Werror,-Wformat] " %s\n", atomic_read(&sess->nconn), - | drivers/target/iscsi/iscsi_target.c:4365:12: error: format specifies | type 'unsigned short' but the argument has type 'int' [-Werror,-Wformat] | " %s\n", atomic_read(&sess->nconn) For all warnings, the format specifier is '%hu' which describes an unsigned short. The resulting type of atomic_read is an int. The proposed fix is to listen to Clang and swap the format specifier. Link: ClangBuiltLinux#378 Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Nick Desaulniers <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Justin Stitt <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent ca45262 commit 71b2569

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/target/iscsi/iscsi_target.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4361,7 +4361,7 @@ int iscsit_close_connection(
43614361

43624362
spin_lock_bh(&sess->conn_lock);
43634363
atomic_dec(&sess->nconn);
4364-
pr_debug("Decremented iSCSI connection count to %hu from node:"
4364+
pr_debug("Decremented iSCSI connection count to %d from node:"
43654365
" %s\n", atomic_read(&sess->nconn),
43664366
sess->sess_ops->InitiatorName);
43674367
/*

drivers/target/iscsi/iscsi_target_login.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ void iscsi_post_login_handler(
715715

716716
list_add_tail(&conn->conn_list, &sess->sess_conn_list);
717717
atomic_inc(&sess->nconn);
718-
pr_debug("Incremented iSCSI Connection count to %hu"
718+
pr_debug("Incremented iSCSI Connection count to %d"
719719
" from node: %s\n", atomic_read(&sess->nconn),
720720
sess->sess_ops->InitiatorName);
721721
spin_unlock_bh(&sess->conn_lock);
@@ -763,7 +763,7 @@ void iscsi_post_login_handler(
763763
spin_lock_bh(&sess->conn_lock);
764764
list_add_tail(&conn->conn_list, &sess->sess_conn_list);
765765
atomic_inc(&sess->nconn);
766-
pr_debug("Incremented iSCSI Connection count to %hu from node:"
766+
pr_debug("Incremented iSCSI Connection count to %d from node:"
767767
" %s\n", atomic_read(&sess->nconn),
768768
sess->sess_ops->InitiatorName);
769769
spin_unlock_bh(&sess->conn_lock);

0 commit comments

Comments
 (0)