From: Arnd Bergmann <arnd@arndb.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>,
James.Bottomley@HansenPartnership.com
Cc: linux-arm-kernel@lists.infradead.org,
Arnd Bergmann <arnd@arndb.de>,
linux-scsi@vger.kernel.org,
"James E.J. Bottomley" <JBottomley@odin.com>,
QLogic-Storage-Upstream@qlogic.com, linux-kernel@vger.kernel.org
Subject: [PATCH 5/7] scsi: qla4xxx: shut up warning for rd_reg_indirect
Date: Wed, 27 Jan 2016 16:57:21 +0100 [thread overview]
Message-ID: <1453910247-3447628-6-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1453910247-3447628-1-git-send-email-arnd@arndb.de>
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
next prev parent reply other threads:[~2016-01-27 15:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 ` Arnd Bergmann [this message]
2016-02-01 8:17 ` [PATCH 5/7] scsi: qla4xxx: shut up warning for rd_reg_indirect 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1453910247-3447628-6-git-send-email-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=JBottomley@odin.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=QLogic-Storage-Upstream@qlogic.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®