Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: "James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: stex: fix MU_MAX_DELAY typecheck
Date: Tue, 17 Jan 2023 17:38:27 +0100	[thread overview]
Message-ID: <20230117163834.1053763-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

time_after() expects arguments of the same type, but gcc-13 changed the
way that typeof(MU_MAX_DELAY) is determined, causing a build warning as
'before + MU_MAX_DELAY * HZ' gets promoted to a 64-bit integer:

In file included from include/linux/bitops.h:7,
                 from include/linux/kernel.h:22,
                 from drivers/scsi/stex.c:13:
drivers/scsi/stex.c: In function 'stex_common_handshake':
include/linux/typecheck.h:12:25: error: comparison of distinct pointer types lacks a cast [-Werror]
   12 |         (void)(&__dummy == &__dummy2); \
      |                         ^~
include/linux/jiffies.h:106:10: note: in expansion of macro 'typecheck'
  106 |          typecheck(unsigned long, b) && \
      |          ^~~~~~~~~
drivers/scsi/stex.c:1035:29: note: in expansion of macro 'time_after'
 1035 |                         if (time_after(jiffies, before + MU_MAX_DELAY * HZ)) {

Change the enum definition so all values fit into an unsigned
32-bit number.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/stex.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 8def242675ef..23462d3c9850 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -110,7 +110,7 @@ enum {
 	TASK_ATTRIBUTE_ORDERED			= 0x2,
 	TASK_ATTRIBUTE_ACA			= 0x4,
 
-	SS_STS_NORMAL				= 0x80000000,
+	SS_STS_NORMAL				= 0x80000000u,
 	SS_STS_DONE				= 0x40000000,
 	SS_STS_HANDSHAKE			= 0x20000000,
 
@@ -120,7 +120,7 @@ enum {
 
 	SS_I2H_REQUEST_RESET			= 0x2000,
 
-	SS_MU_OPERATIONAL			= 0x80000000,
+	SS_MU_OPERATIONAL			= 0x80000000u,
 
 	STEX_CDB_LENGTH				= 16,
 	STATUS_VAR_LEN				= 128,
@@ -173,7 +173,7 @@ enum {
 	ST_ADDITIONAL_MEM_MIN			= 0x80000,
 	PMIC_SHUTDOWN				= 0x0D,
 	PMIC_REUMSE					= 0x10,
-	ST_IGNORED					= -1,
+	ST_IGNORED					= -1u,
 	ST_NOTHANDLED				= 7,
 	ST_S3						= 3,
 	ST_S4						= 4,
-- 
2.39.0


             reply	other threads:[~2023-01-17 16:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 16:38 Arnd Bergmann [this message]
2023-01-17 17:43 ` [PATCH] scsi: stex: fix MU_MAX_DELAY typecheck Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230117163834.1053763-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox