public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iscsi: iscsi_target: fix clang -Wformat warning
@ 2022-07-08 22:13 Justin Stitt
  2022-07-08 23:41 ` Nick Desaulniers
  0 siblings, 1 reply; 2+ messages in thread
From: Justin Stitt @ 2022-07-08 22:13 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix, Mike Christie,
	Max Gurtovoy, Mingzhe Zou, Justin Stitt, linux-scsi, target-devel,
	linux-kernel, llvm

When building with Clang we encounter this warning:
| 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)

The format specifier used is `%hu` which describes an unsigned short.
However, atomic_read returns an int which means the format specifier
should be `%d`.

Link: https://github.com/ClangBuiltLinux/linux/issues/378
Signed-off-by: Justin Stitt <justinstitt@google.com>
---
 drivers/target/iscsi/iscsi_target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index e368f038ff5c..bfb717065344 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -4361,7 +4361,7 @@ int iscsit_close_connection(
 
 	spin_lock_bh(&sess->conn_lock);
 	atomic_dec(&sess->nconn);
-	pr_debug("Decremented iSCSI connection count to %hu from node:"
+	pr_debug("Decremented iSCSI connection count to %d from node:"
 		" %s\n", atomic_read(&sess->nconn),
 		sess->sess_ops->InitiatorName);
 	/*
-- 
2.37.0.rc0.161.g10f37bed90-goog


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

* Re: [PATCH] iscsi: iscsi_target: fix clang -Wformat warning
  2022-07-08 22:13 [PATCH] iscsi: iscsi_target: fix clang -Wformat warning Justin Stitt
@ 2022-07-08 23:41 ` Nick Desaulniers
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Desaulniers @ 2022-07-08 23:41 UTC (permalink / raw)
  To: Justin Stitt
  Cc: Martin K . Petersen, Nathan Chancellor, Tom Rix, Mike Christie,
	Max Gurtovoy, Mingzhe Zou, linux-scsi, target-devel, linux-kernel,
	llvm

On Fri, Jul 8, 2022 at 3:14 PM Justin Stitt <justinstitt@google.com> wrote:
>
> When building with Clang we encounter this warning:
> | 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)
>
> The format specifier used is `%hu` which describes an unsigned short.
> However, atomic_read returns an int which means the format specifier
> should be `%d`.

Thanks for the patches!

Please fold this into:
https://lore.kernel.org/llvm/20220708221314.466294-1-justinstitt@google.com/
and send a v2 of that.

>
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Justin Stitt <justinstitt@google.com>
> ---
>  drivers/target/iscsi/iscsi_target.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
> index e368f038ff5c..bfb717065344 100644
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c
> @@ -4361,7 +4361,7 @@ int iscsit_close_connection(
>
>         spin_lock_bh(&sess->conn_lock);
>         atomic_dec(&sess->nconn);
> -       pr_debug("Decremented iSCSI connection count to %hu from node:"
> +       pr_debug("Decremented iSCSI connection count to %d from node:"
>                 " %s\n", atomic_read(&sess->nconn),
>                 sess->sess_ops->InitiatorName);
>         /*
> --
> 2.37.0.rc0.161.g10f37bed90-goog
>


-- 
Thanks,
~Nick Desaulniers

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

end of thread, other threads:[~2022-07-08 23:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-08 22:13 [PATCH] iscsi: iscsi_target: fix clang -Wformat warning Justin Stitt
2022-07-08 23:41 ` Nick Desaulniers

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