* [PATCH v2 0/3] qla2xxx: Patches for kernel v4.7
@ 2016-03-31 16:28 Bart Van Assche
2016-03-31 16:29 ` [PATCH v2 1/3] qla2xxx: Indicate out-of-memory with -ENOMEM Bart Van Assche
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Bart Van Assche @ 2016-03-31 16:28 UTC (permalink / raw)
To: James Bottomley, Martin K. Petersen
Cc: Himanshu Madhani, Quinn Tran, Johannes Thumshirn,
Christoph Hellwig, linux-scsi@vger.kernel.org
Hello James and Martin,
The following three patches are what I came up with after having
analyzed the output of gcc and of a static source code analysis tool
(sparse) for the QLogic qla2xxx driver:
0001-qla2xxx-Indicate-out-of-memory-with-ENOMEM.patch
0002-qla2xxx-Remove-set-but-not-used-variables.patch
0003-qla2xxx-Fix-a-compiler-warning.patch
Please consider these patches for inclusion in kernel v4.7.
The changes compared to v1 of this patch series are:
* Restored the code in patch 2/3 that sets BIT_14.
* Dropped the patch that removes the code for setting flags that are
not checked.
* Added a patch that fixes a compiler warning.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/3] qla2xxx: Indicate out-of-memory with -ENOMEM
2016-03-31 16:28 [PATCH v2 0/3] qla2xxx: Patches for kernel v4.7 Bart Van Assche
@ 2016-03-31 16:29 ` Bart Van Assche
2016-03-31 16:29 ` [PATCH v2 2/3] qla2xxx: Remove set-but-not-used variables Bart Van Assche
2016-03-31 16:30 ` [PATCH v2 3/3] qla2xxx: Fix a compiler warning Bart Van Assche
2 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2016-03-31 16:29 UTC (permalink / raw)
To: James Bottomley, Martin K. Petersen
Cc: Himanshu Madhani, Quinn Tran, Johannes Thumshirn,
Christoph Hellwig, linux-scsi@vger.kernel.org
In the Linux kernel it is preferred to return a meaningful error code
instead of -1. This patch does not change the behavior of the caller of
qla82xx_pinit_from_rom().
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Acked-by: Quinn Tran <quinn.tran@qlogic.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Himanshu Madhani <himanshu.madhani@qlogic.com>
Cc: Christoph Hellwig <hch@lst.de>
---
drivers/scsi/qla2xxx/qla_nx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index b6b4cfd..54380b4 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -1229,7 +1229,7 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha)
if (buf == NULL) {
ql_log(ql_log_fatal, vha, 0x010c,
"Unable to allocate memory.\n");
- return -1;
+ return -ENOMEM;
}
for (i = 0; i < n; i++) {
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/3] qla2xxx: Remove set-but-not-used variables
2016-03-31 16:28 [PATCH v2 0/3] qla2xxx: Patches for kernel v4.7 Bart Van Assche
2016-03-31 16:29 ` [PATCH v2 1/3] qla2xxx: Indicate out-of-memory with -ENOMEM Bart Van Assche
@ 2016-03-31 16:29 ` Bart Van Assche
2016-03-31 16:30 ` [PATCH v2 3/3] qla2xxx: Fix a compiler warning Bart Van Assche
2 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2016-03-31 16:29 UTC (permalink / raw)
To: James Bottomley, Martin K. Petersen
Cc: Himanshu Madhani, Quinn Tran, Johannes Thumshirn,
Christoph Hellwig, linux-scsi@vger.kernel.org
Detected these variables by building the qla2xxx driver with W=1.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Quinn Tran <quinn.tran@qlogic.com>
Cc: Himanshu Madhani <himanshu.madhani@qlogic.com>
Cc: Christoph Hellwig <hch@lst.de>
---
drivers/scsi/qla2xxx/qla_attr.c | 3 +--
drivers/scsi/qla2xxx/qla_mbx.c | 2 --
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 4dc06a13..db85c5c 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -839,7 +839,6 @@ qla2x00_issue_logo(struct file *filp, struct kobject *kobj,
struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
struct device, kobj)));
int type;
- int rval = 0;
port_id_t did;
type = simple_strtol(buf, NULL, 10);
@@ -853,7 +852,7 @@ qla2x00_issue_logo(struct file *filp, struct kobject *kobj,
ql_log(ql_log_info, vha, 0x70e4, "%s: %d\n", __func__, type);
- rval = qla24xx_els_dcmd_iocb(vha, ELS_DCMD_LOGO, did);
+ qla24xx_els_dcmd_iocb(vha, ELS_DCMD_LOGO, did);
return count;
}
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 968b846..bf2d357 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -607,7 +607,6 @@ qla_set_exlogin_mem_cfg(scsi_qla_host_t *vha, dma_addr_t phys_addr)
mbx_cmd_t mc;
mbx_cmd_t *mcp = &mc;
struct qla_hw_data *ha = vha->hw;
- int configured_count;
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x111a,
"Entered %s.\n", __func__);
@@ -630,7 +629,6 @@ qla_set_exlogin_mem_cfg(scsi_qla_host_t *vha, dma_addr_t phys_addr)
/*EMPTY*/
ql_dbg(ql_dbg_mbx, vha, 0x111b, "Failed=%x.\n", rval);
} else {
- configured_count = mcp->mb[11];
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x118c,
"Done %s.\n", __func__);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 3/3] qla2xxx: Fix a compiler warning
2016-03-31 16:28 [PATCH v2 0/3] qla2xxx: Patches for kernel v4.7 Bart Van Assche
2016-03-31 16:29 ` [PATCH v2 1/3] qla2xxx: Indicate out-of-memory with -ENOMEM Bart Van Assche
2016-03-31 16:29 ` [PATCH v2 2/3] qla2xxx: Remove set-but-not-used variables Bart Van Assche
@ 2016-03-31 16:30 ` Bart Van Assche
2 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2016-03-31 16:30 UTC (permalink / raw)
To: James Bottomley, Martin K. Petersen
Cc: Himanshu Madhani, Quinn Tran, Johannes Thumshirn,
Christoph Hellwig, linux-scsi@vger.kernel.org
Avoid that gcc reports the following warning:
drivers/scsi/qla2xxx/qla_target.c:3094:6: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Quinn Tran <quinn.tran@qlogic.com>
Cc: Himanshu Madhani <himanshu.madhani@qlogic.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
---
drivers/scsi/qla2xxx/qla_target.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 7158f9d..87b301d 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3099,10 +3099,11 @@ static void qlt_send_term_imm_notif(struct scsi_qla_host *vha,
if (ha_locked) {
rc = __qlt_send_term_imm_notif(vha, imm);
+ if (rc == -ENOMEM) {
#if 0 /* Todo */
- if (rc == -ENOMEM)
qlt_alloc_qfull_cmd(vha, imm, 0, 0);
#endif
+ }
goto done;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-31 16:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-31 16:28 [PATCH v2 0/3] qla2xxx: Patches for kernel v4.7 Bart Van Assche
2016-03-31 16:29 ` [PATCH v2 1/3] qla2xxx: Indicate out-of-memory with -ENOMEM Bart Van Assche
2016-03-31 16:29 ` [PATCH v2 2/3] qla2xxx: Remove set-but-not-used variables Bart Van Assche
2016-03-31 16:30 ` [PATCH v2 3/3] qla2xxx: Fix a compiler warning Bart Van Assche
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).