scsi: core: Fix -Wformat for scsi_host
authorNick Desaulniers <ndesaulniers@google.com>
Sat, 7 Nov 2020 08:11:32 +0000 (00:11 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 17 Nov 2020 03:33:59 +0000 (22:33 -0500)
Clang is more aggressive about -Wformat warnings when the format flag
specifies a type smaller than the parameter. Turns out, struct Scsi_Host's
member can_queue is actually an int. Fixes:

[-Wformat]
shost_rd_attr(can_queue, "%hd\n");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          %d

Link: https://github.com/ClangBuiltLinux/linux/issues/378
Link: https://lore.kernel.org/r/20201107081132.2629071-1-ndesaulniers@google.com
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
warning: format specifies type 'short' but the argument has type 'int'

drivers/scsi/scsi_sysfs.c

index d6e344fa33ad90544d9d9ca588fe3ccbf72d9fcc..b6378c8ca783eafe6f93ed3a1a7b59ed26e190de 100644 (file)
@@ -370,7 +370,7 @@ static DEVICE_ATTR(eh_deadline, S_IRUGO | S_IWUSR, show_shost_eh_deadline, store
 
 shost_rd_attr(unique_id, "%u\n");
 shost_rd_attr(cmd_per_lun, "%hd\n");
-shost_rd_attr(can_queue, "%hd\n");
+shost_rd_attr(can_queue, "%d\n");
 shost_rd_attr(sg_tablesize, "%hu\n");
 shost_rd_attr(sg_prot_tablesize, "%hu\n");
 shost_rd_attr(unchecked_isa_dma, "%d\n");