scsi: stex: fix MU_MAX_DELAY typecheck
PATCH 1/1 scsi: stex: fix MU_MAX_DELAY typecheck
From: Arnd Bergmann <[email protected]>
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.
--- drivers/scsi/stex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/stex.c +3 -3
@@ -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,
Signature · 1 line
2.39.0
drivers/scsi/stex.c enum { · line 179
Quoted 9 lines · Arnd Bergmann
drivers/scsi/stex.c +1
-1@@ -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,
From drivers/scsi/stex.c:
int st_sleep_mic;
... st_sleep_mic == ST_IGNORED ...
Can changing ST_IGNORED from signed to unsigned break the stex driver?
Thanks,
Bart.