mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/7] scsi: fdomain: drop fdomain_pci_tbl when built-in
       [not found] <1453910247-3447628-1-git-send-email-arnd@arndb.de>
@ 2016-01-27 15:57 ` Arnd Bergmann
  2016-01-27 15:57 ` [PATCH 2/7] mptfusion: hide unused seq_mpt_print_ioc_summary function Arnd Bergmann
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2016-01-27 15:57 UTC (permalink / raw)
  To: Martin K. Petersen, James.Bottomley
  Cc: linux-arm-kernel, Arnd Bergmann, linux-scsi,
	James E.J. Bottomley, Rik Faith, linux-kernel

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(-)

diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index eefe14d453db..b87ab38a4530 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -1768,7 +1768,7 @@ struct scsi_host_template fdomain_driver_template = {
 };
 
 #ifndef PCMCIA
-#ifdef CONFIG_PCI
+#if defined(CONFIG_PCI) && defined(MODULE)
 
 static struct pci_device_id fdomain_pci_tbl[] = {
 	{ PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70,
-- 
2.7.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/7] mptfusion: hide unused seq_mpt_print_ioc_summary function
       [not found] <1453910247-3447628-1-git-send-email-arnd@arndb.de>
  2016-01-27 15:57 ` [PATCH 1/7] scsi: fdomain: drop fdomain_pci_tbl when built-in Arnd Bergmann
@ 2016-01-27 15:57 ` Arnd Bergmann
  2016-01-27 15:57 ` [PATCH 3/7] scsi: acornscsi: mark calc_sync_xfer as __maybe_unused Arnd Bergmann
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2016-01-27 15:57 UTC (permalink / raw)
  To: Martin K. Petersen, James.Bottomley, Nagalakshmi Nandigama,
	Praveen Krishnamoorthy, Sreekanth Reddy, Abhijit Mahajan
  Cc: linux-arm-kernel, Arnd Bergmann, linux-scsi,
	James E.J. Bottomley, MPT-FusionLinux.pdl, linux-kernel

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(+)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 5dcc0313c38a..207370d68c17 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -6848,6 +6848,7 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh
 	*size = y;
 }
 
+#ifdef CONFIG_PROC_FS
 static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc, struct seq_file *m, int showlan)
 {
 	char expVer[32];
@@ -6879,6 +6880,7 @@ static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc, struct seq_file *m, int
 
 	seq_putc(m, '\n');
 }
+#endif
 
 /**
  *	mpt_set_taskmgmt_in_progress_flag - set flags associated with task management
-- 
2.7.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/7] scsi: acornscsi: mark calc_sync_xfer as __maybe_unused
       [not found] <1453910247-3447628-1-git-send-email-arnd@arndb.de>
  2016-01-27 15:57 ` [PATCH 1/7] scsi: fdomain: drop fdomain_pci_tbl when built-in Arnd Bergmann
  2016-01-27 15:57 ` [PATCH 2/7] mptfusion: hide unused seq_mpt_print_ioc_summary function Arnd Bergmann
@ 2016-01-27 15:57 ` Arnd Bergmann
  2016-01-27 15:57 ` [PATCH 4/7] scsi: fas216: avoid fas216_log_setup for loadable module Arnd Bergmann
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2016-01-27 15:57 UTC (permalink / raw)
  To: Martin K. Petersen, James.Bottomley
  Cc: linux-arm-kernel, Arnd Bergmann, linux-scsi,
	James E.J. Bottomley, Russell King, linux-kernel

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(-)

diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c
index deaaf84989cd..12b88294d667 100644
--- a/drivers/scsi/arm/acornscsi.c
+++ b/drivers/scsi/arm/acornscsi.c
@@ -677,7 +677,8 @@ int round_period(unsigned int period)
  * Copyright: Copyright (c) 1996 John Shifflett, GeoLog Consulting
  */
 static
-unsigned char calc_sync_xfer(unsigned int period, unsigned int offset)
+unsigned char __maybe_unused calc_sync_xfer(unsigned int period,
+					    unsigned int offset)
 {
     return sync_xfer_table[round_period(period)].reg_value |
 		((offset < SDTR_SIZE) ? offset : SDTR_SIZE);
-- 
2.7.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/7] scsi: fas216: avoid fas216_log_setup for loadable module
       [not found] <1453910247-3447628-1-git-send-email-arnd@arndb.de>
                   ` (2 preceding siblings ...)
  2016-01-27 15:57 ` [PATCH 3/7] scsi: acornscsi: mark calc_sync_xfer as __maybe_unused Arnd Bergmann
@ 2016-01-27 15:57 ` Arnd Bergmann
  2016-01-27 15:57 ` [PATCH 5/7] scsi: qla4xxx: shut up warning for rd_reg_indirect Arnd Bergmann
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2016-01-27 15:57 UTC (permalink / raw)
  To: Martin K. Petersen, James.Bottomley
  Cc: linux-arm-kernel, Arnd Bergmann, linux-scsi,
	James E.J. Bottomley, Russell King, linux-kernel

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(+)

diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index decdc71b6b86..24388795ee9a 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -98,6 +98,7 @@ static int level_mask = LOG_ERROR;
 
 module_param(level_mask, int, 0644);
 
+#ifndef MODULE
 static int __init fas216_log_setup(char *str)
 {
 	char *s;
@@ -138,6 +139,7 @@ static int __init fas216_log_setup(char *str)
 }
 
 __setup("fas216_logging=", fas216_log_setup);
+#endif
 
 static inline unsigned char fas216_readb(FAS216_Info *info, unsigned int reg)
 {
-- 
2.7.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 5/7] scsi: qla4xxx: shut up warning for rd_reg_indirect
       [not found] <1453910247-3447628-1-git-send-email-arnd@arndb.de>
                   ` (3 preceding siblings ...)
  2016-01-27 15:57 ` [PATCH 4/7] scsi: fas216: avoid fas216_log_setup for loadable module Arnd Bergmann
@ 2016-01-27 15:57 ` Arnd Bergmann
  2016-02-01  8:17   ` Nilesh Javali
  2016-01-27 15:57 ` [PATCH 6/7] scsi: aha1542: avoid uninitialized variable warnings Arnd Bergmann
  2016-01-27 15:57 ` [PATCH 7/7] scsi_dh: force modular build if SCSI is a module Arnd Bergmann
  6 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2016-01-27 15:57 UTC (permalink / raw)
  To: Martin K. Petersen, James.Bottomley
  Cc: linux-arm-kernel, Arnd Bergmann, linux-scsi,
	James E.J. Bottomley, QLogic-Storage-Upstream, linux-kernel

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
--- a/drivers/scsi/qla4xxx/ql4_83xx.c
+++ b/drivers/scsi/qla4xxx/ql4_83xx.c
@@ -46,11 +46,13 @@ int qla4_83xx_rd_reg_indirect(struct scsi_qla_host *ha, uint32_t addr,
 
 	ret_val = qla4_83xx_set_win_base(ha, addr);
 
-	if (ret_val == QLA_SUCCESS)
+	if (ret_val == QLA_SUCCESS) {
 		*data = qla4_83xx_rd_reg(ha, QLA83XX_WILDCARD);
-	else
+	} else {
+		*data = 0xffffffff;
 		ql4_printk(KERN_ERR, ha, "%s: failed read of addr 0x%x!\n",
 			   __func__, addr);
+	}
 
 	return ret_val;
 }
-- 
2.7.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 6/7] scsi: aha1542: avoid uninitialized variable warnings
       [not found] <1453910247-3447628-1-git-send-email-arnd@arndb.de>
                   ` (4 preceding siblings ...)
  2016-01-27 15:57 ` [PATCH 5/7] scsi: qla4xxx: shut up warning for rd_reg_indirect Arnd Bergmann
@ 2016-01-27 15:57 ` Arnd Bergmann
  2016-01-27 15:57 ` [PATCH 7/7] scsi_dh: force modular build if SCSI is a module Arnd Bergmann
  6 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2016-01-27 15:57 UTC (permalink / raw)
  To: Martin K. Petersen, James.Bottomley
  Cc: linux-arm-kernel, Arnd Bergmann, linux-scsi,
	James E.J. Bottomley, linux-kernel

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(+)

diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 5b8b2937a3fe..7db448ec8beb 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -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)
 			return SCSI_MLQUEUE_HOST_BUSY;
+	} else {
+		sg_count = 0;
+		cptr = NULL;
 	}
 
 	/* Use the outgoing mailboxes in a round-robin fashion, because this
-- 
2.7.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 7/7] scsi_dh: force modular build if SCSI is a module
       [not found] <1453910247-3447628-1-git-send-email-arnd@arndb.de>
                   ` (5 preceding siblings ...)
  2016-01-27 15:57 ` [PATCH 6/7] scsi: aha1542: avoid uninitialized variable warnings Arnd Bergmann
@ 2016-01-27 15:57 ` Arnd Bergmann
  6 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2016-01-27 15:57 UTC (permalink / raw)
  To: Martin K. Petersen, James.Bottomley
  Cc: linux-arm-kernel, Arnd Bergmann, linux-scsi,
	James E.J. Bottomley, Mike Snitzer, Hannes Reinecke,
	linux-kernel

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(-)

diff --git a/drivers/scsi/device_handler/Kconfig b/drivers/scsi/device_handler/Kconfig
index e5647d59224f..0b331c9c0a8f 100644
--- a/drivers/scsi/device_handler/Kconfig
+++ b/drivers/scsi/device_handler/Kconfig
@@ -13,13 +13,13 @@ menuconfig SCSI_DH
 
 config SCSI_DH_RDAC
 	tristate "LSI RDAC Device Handler"
-	depends on SCSI_DH
+	depends on SCSI_DH && SCSI
 	help
 	If you have a LSI RDAC select y. Otherwise, say N.
 
 config SCSI_DH_HP_SW
 	tristate "HP/COMPAQ MSA Device Handler"
-	depends on SCSI_DH
+	depends on SCSI_DH && SCSI
 	help
 	If you have a HP/COMPAQ MSA device that requires START_STOP to
 	be sent to start it and cannot upgrade the firmware then select y.
@@ -27,13 +27,13 @@ config SCSI_DH_HP_SW
 
 config SCSI_DH_EMC
 	tristate "EMC CLARiiON Device Handler"
-	depends on SCSI_DH
+	depends on SCSI_DH && SCSI
 	help
 	If you have a EMC CLARiiON select y. Otherwise, say N.
 
 config SCSI_DH_ALUA
 	tristate "SPC-3 ALUA Device Handler"
-	depends on SCSI_DH
+	depends on SCSI_DH && SCSI
 	help
 	  SCSI Device handler for generic SPC-3 Asymmetric Logical Unit
 	  Access (ALUA).
-- 
2.7.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 5/7] scsi: qla4xxx: shut up warning for rd_reg_indirect
  2016-01-27 15:57 ` [PATCH 5/7] scsi: qla4xxx: shut up warning for rd_reg_indirect Arnd Bergmann
@ 2016-02-01  8:17   ` Nilesh Javali
  0 siblings, 0 replies; 8+ messages in thread
From: Nilesh Javali @ 2016-02-01  8:17 UTC (permalink / raw)
  To: Arnd Bergmann, Martin K. Petersen, James.Bottomley
  Cc: linux-arm-kernel, linux-scsi, James E.J. Bottomley,
	Dept-Eng QLogic Storage Upstream, linux-kernel



On 27/01/16 9:27 PM, "Arnd Bergmann" <arnd@arndb.de> wrote:

>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
>--- a/drivers/scsi/qla4xxx/ql4_83xx.c
>+++ b/drivers/scsi/qla4xxx/ql4_83xx.c
>@@ -46,11 +46,13 @@ int qla4_83xx_rd_reg_indirect(struct scsi_qla_host
>*ha, uint32_t addr,
> 
> 	ret_val = qla4_83xx_set_win_base(ha, addr);
> 
>-	if (ret_val == QLA_SUCCESS)
>+	if (ret_val == QLA_SUCCESS) {
> 		*data = qla4_83xx_rd_reg(ha, QLA83XX_WILDCARD);
>-	else
>+	} else {
>+		*data = 0xffffffff;
> 		ql4_printk(KERN_ERR, ha, "%s: failed read of addr 0x%x!\n",
> 			   __func__, addr);
>+	}
> 
> 	return ret_val;
> }
>-- 
>2.7.0
>

Acked-by: Nilesh Javali <nilesh.javali@qlogic.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-02-01  8:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1453910247-3447628-1-git-send-email-arnd@arndb.de>
2016-01-27 15:57 ` [PATCH 1/7] scsi: fdomain: drop fdomain_pci_tbl when built-in Arnd Bergmann
2016-01-27 15:57 ` [PATCH 2/7] mptfusion: hide unused seq_mpt_print_ioc_summary function Arnd Bergmann
2016-01-27 15:57 ` [PATCH 3/7] scsi: acornscsi: mark calc_sync_xfer as __maybe_unused Arnd Bergmann
2016-01-27 15:57 ` [PATCH 4/7] scsi: fas216: avoid fas216_log_setup for loadable module Arnd Bergmann
2016-01-27 15:57 ` [PATCH 5/7] scsi: qla4xxx: shut up warning for rd_reg_indirect Arnd Bergmann
2016-02-01  8:17   ` Nilesh Javali
2016-01-27 15:57 ` [PATCH 6/7] scsi: aha1542: avoid uninitialized variable warnings Arnd Bergmann
2016-01-27 15:57 ` [PATCH 7/7] scsi_dh: force modular build if SCSI is a module Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®