Skip to content

Commit 78882c7

Browse files
nathanchancemartinkpetersen
authored andcommitted
scsi: ibmvfc: Use 'unsigned int' for single-bit bitfields in 'struct ibmvfc_host'
Clang warns (or errors with CONFIG_WERROR=y) several times along the lines of: drivers/scsi/ibmvscsi/ibmvfc.c:650:17: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion] 650 | vhost->reinit = 1; | ^ ~ A single-bit signed integer bitfield only has possible values of -1 and 0, not 0 and 1 like an unsigned one would. No context appears to check the actual value of these bitfields, just whether or not it is zero. However, it is easy enough to change the type of the fields to 'unsigned int', which keeps the same size in memory and resolves the warning. Fixes: 5144905 ("scsi: ibmvfc: Use a bitfield for boolean flags") Signed-off-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Nick Desaulniers <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 4df105f commit 78882c7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/scsi/ibmvscsi/ibmvfc.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -892,15 +892,15 @@ struct ibmvfc_host {
892892
int init_retries;
893893
int discovery_threads;
894894
int abort_threads;
895-
int client_migrated:1;
896-
int reinit:1;
897-
int delay_init:1;
898-
int logged_in:1;
899-
int mq_enabled:1;
900-
int using_channels:1;
901-
int do_enquiry:1;
902-
int aborting_passthru:1;
903-
int scan_complete:1;
895+
unsigned int client_migrated:1;
896+
unsigned int reinit:1;
897+
unsigned int delay_init:1;
898+
unsigned int logged_in:1;
899+
unsigned int mq_enabled:1;
900+
unsigned int using_channels:1;
901+
unsigned int do_enquiry:1;
902+
unsigned int aborting_passthru:1;
903+
unsigned int scan_complete:1;
904904
int scan_timeout;
905905
int events_to_log;
906906
#define IBMVFC_AE_LINKUP 0x0001

0 commit comments

Comments
 (0)