Here are a bunch of fixes for harmless bugs I found during ARM
randconfig testing. It would be nice to get them mered in 4.6,
but there is no need to have them in 4.5 as no incorrect behavior
results from the current code, and the warnings are all hard
to trigger.
Arnd Bergmann (7):
scsi: fdomain: drop fdomain_pci_tbl when built-in
mptfusion: hide unused seq_mpt_print_ioc_summary function
scsi: acornscsi: mark calc_sync_xfer as __maybe_unused
scsi: fas216: avoid fas216_log_setup for loadable module
scsi: qla4xxx: shut up warning for rd_reg_indirect
scsi: aha1542: avoid uninitialized variable warnings
scsi_dh: force modular build if SCSI is a module
drivers/message/fusion/mptbase.c | 2 ++
drivers/scsi/aha1542.c | 3 +++
drivers/scsi/arm/acornscsi.c | 3 ++-
drivers/scsi/arm/fas216.c | 2 ++
drivers/scsi/device_handler/Kconfig | 8 ++++----
drivers/scsi/fdomain.c | 2 +-
drivers/scsi/qla4xxx/ql4_83xx.c | 6 ++++--
7 files changed, 18 insertions(+), 8 deletions(-)
--
2.7.0
The fdomain SCSI host driver is one of the last remaining
drivers that manually search the PCI bus using pci_get_device
rather than registering a pci_driver instance.
This means the module device table is unused when the driver is
built-in, and we get a warning about it:
drivers/scsi/fdomain.c:1773:29: warning: 'fdomain_pci_tbl' defined but not used [-Wunused-variable]
To avoid the warning, this adds another #ifdef around the table
definition.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/fdomain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
The seq_mpt_print_ioc_summary function is used for the /proc/mpt/iocN/summary
implementation and never gets called when CONFIG_PROC_FS is disabled:
drivers/message/fusion/mptbase.c:6851:13: warning: 'seq_mpt_print_ioc_summary' defined but not used [-Wunused-function]
static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc, struct seq_file *m, int showlan)
This adds an #ifdef to hide the function definition in that case
and avoid the warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/message/fusion/mptbase.c | 2 ++
1 file changed, 2 insertions(+)
@@ -6848,6 +6848,7 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh*size=y;}+#ifdef CONFIG_PROC_FSstaticvoidseq_mpt_print_ioc_summary(MPT_ADAPTER*ioc,structseq_file*m,intshowlan){charexpVer[32];
The calc_sync_xfer function is only used if CONFIG_SCSI_ACORNSCSI_SYNC
is set, otherwise we get a compiler warning:
scsi/arm/acornscsi.c:680:15: warning: 'calc_sync_xfer' defined but not used [-Wunused-function]
unsigned char calc_sync_xfer(unsigned int period, unsigned int offset)
This marks the function as __maybe_unused to shut up the
warning and silently drop the function in the object code
when there is no caller.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/arm/acornscsi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
@@ -677,7 +677,8 @@ int round_period(unsigned int period)*Copyright:Copyright(c)1996JohnShifflett,GeoLogConsulting*/static-unsignedcharcalc_sync_xfer(unsignedintperiod,unsignedintoffset)+unsignedchar__maybe_unusedcalc_sync_xfer(unsignedintperiod,+unsignedintoffset){returnsync_xfer_table[round_period(period)].reg_value|((offset<SDTR_SIZE)?offset:SDTR_SIZE);
We get a warning for the fas216 driver when it is compiled as
a loadable module, as the __setup() functions are never called
then:
scsi/arm/fas216.c:101:19: warning: 'fas216_log_setup' defined but not used [-Wunused-function]
static int __init fas216_log_setup(char *str)
This adds an #ifndef MODULE around the definition to shut up
the warning and clarify for the reader when it is used or not.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/arm/fas216.c | 2 ++
1 file changed, 2 insertions(+)
The qla4_83xx_rd_reg_indirect() function can fail when it is unable
to read a register, but not all callers check its return value before
using the register data, and gcc correctly warns about this:
qla4xxx/ql4_83xx.c: In function 'qla4_83xx_process_reset_template':
qla4xxx/ql4_83xx.c:1073:36: warning: 'value' may be used uninitialized in this function
ha->reset_tmplt.array[index++] = value;
^
qla4xxx/ql4_83xx.c:1050:11: note: 'value' was declared here
uint32_t value;
^
qla4xxx/ql4_83xx.c:902:8: warning: 'value' may be used uninitialized in this function
value &= p_rmw_hdr->test_mask;
^
qla4xxx/ql4_83xx.c:895:11: note: 'value' was declared here
uint32_t value;
^
In file included from ../include/linux/io.h:25:0,
from ../include/linux/pci.h:31,
from ../drivers/scsi/qla4xxx/ql4_def.h:16,
from ../drivers/scsi/qla4xxx/ql4_83xx.c:10:
asm/io.h:101:2: warning: 'value' may be used uninitialized in this function
asm volatile("str %1, %0"
^
qla4xxx/ql4_83xx.c:874:11: note: 'value' was declared here
uint32_t value;
^
Unfortunately, I don't see any helpful way to add proper error handling
for this case, and the failure scenario for rd_reg seems rather obscure,
so this bails out and makes the rd_reg accessor set the result to 0xffffffff
so we at least get a predictable value.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/qla4xxx/ql4_83xx.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Gcc incorrectly detects that two variables in aha1542_queuecommand might
be used without an initialization:
scsi/aha1542.c: In function 'aha1542_queuecommand':
scsi/aha1542.c:382:16: error: 'cptr' may be used uninitialized in this function [-Werror=maybe-uninitialized]
scsi/aha1542.c:379:11: error: 'sg_count' may be used uninitialized in this function [-Werror=maybe-uninitialized]
The only user of these is doing the same check that the assigment
has, so it is actually guaranteed to work. Adding an "else" clause
with a fake initialization shuts up the warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/aha1542.c | 3 +++
1 file changed, 3 insertions(+)
@@ -403,6 +403,9 @@ static int aha1542_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)cptr=kmalloc(sizeof(*cptr)*sg_count,GFP_KERNEL|GFP_DMA);if(!cptr)returnSCSI_MLQUEUE_HOST_BUSY;+}else{+sg_count=0;+cptr=NULL;}/* Use the outgoing mailboxes in a round-robin fashion, because this
When the scsi_dh core was moved into the scsi core module,
CONFIG_SCSI_DH became a 'bool' option, and now anything depending
on it can be built-in even when CONFIG_SCSI=m. This of course
cannot link successfully:
drivers/scsi/built-in.o: In function `rdac_init':
scsi_dh_alua.c:(.init.text+0x14): undefined reference to `scsi_register_device_handler'
scsi_dh_alua.c:(.init.text+0x64): undefined reference to `scsi_unregister_device_handler'
drivers/scsi/built-in.o: In function `alua_init':
scsi_dh_alua.c:(.init.text+0xb0): undefined reference to `scsi_register_device_handler'
As a workaround, this adds an extra dependency on CONFIG_SCSI,
so Kconfig can figure out whether built-in is allowed or not.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 086b91d052eb ("scsi_dh: integrate into the core SCSI code")
---
drivers/scsi/device_handler/Kconfig | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
On 27/01/16 9:27 PM, "Arnd Bergmann" [off-list ref] wrote:
quoted hunk
The qla4_83xx_rd_reg_indirect() function can fail when it is unable
to read a register, but not all callers check its return value before
using the register data, and gcc correctly warns about this:
qla4xxx/ql4_83xx.c: In function 'qla4_83xx_process_reset_template':
qla4xxx/ql4_83xx.c:1073:36: warning: 'value' may be used uninitialized in
this function
ha->reset_tmplt.array[index++] = value;
^
qla4xxx/ql4_83xx.c:1050:11: note: 'value' was declared here
uint32_t value;
^
qla4xxx/ql4_83xx.c:902:8: warning: 'value' may be used uninitialized in
this function
value &= p_rmw_hdr->test_mask;
^
qla4xxx/ql4_83xx.c:895:11: note: 'value' was declared here
uint32_t value;
^
In file included from ../include/linux/io.h:25:0,
from ../include/linux/pci.h:31,
from ../drivers/scsi/qla4xxx/ql4_def.h:16,
from ../drivers/scsi/qla4xxx/ql4_83xx.c:10:
asm/io.h:101:2: warning: 'value' may be used uninitialized in this
function
asm volatile("str %1, %0"
^
qla4xxx/ql4_83xx.c:874:11: note: 'value' was declared here
uint32_t value;
^
Unfortunately, I don't see any helpful way to add proper error handling
for this case, and the failure scenario for rd_reg seems rather obscure,
so this bails out and makes the rd_reg accessor set the result to
0xffffffff
so we at least get a predictable value.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/qla4xxx/ql4_83xx.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_83xx.c
b/drivers/scsi/qla4xxx/ql4_83xx.c
index 5d4f8e67fb25..638f72c5ab05 100644