Skip to contentSkip to conversation

qla2xxx: Patches for kernel v4.7

PATCH New Bart Van Assche 1 participant 4 messages Mar 31, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover qla2xxx: Patches for kernel v4.7

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.

#1 lore raw

PATCH v2 1/3 qla2xxx: Indicate out-of-memory with -ENOMEM

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

---
 drivers/scsi/qla2xxx/qla_nx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_nx.c +1 -1
index b6b4cfd..54380b4 100644
@@ -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++) {
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 2/3 qla2xxx: Remove set-but-not-used variables

In reply to Bart Van Assche

Detected these variables by building the qla2xxx driver with W=1.

Cc Quinn Tran <[email protected]>
Cc Himanshu Madhani <[email protected]>
Cc Christoph Hellwig <[email protected]>
---
 drivers/scsi/qla2xxx/qla_attr.c | 3 +--
 drivers/scsi/qla2xxx/qla_mbx.c  | 2 --
 2 files changed, 1 insertion(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +1 -2
index 4dc06a13..db85c5c 100644
@@ -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;
 }
 
drivers/scsi/qla2xxx/qla_mbx.c +0 -2
index 968b846..bf2d357 100644
@@ -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__);
 	}
Signature · 1 line
2.7.4
#3 lore raw

PATCH v2 3/3 qla2xxx: Fix a compiler warning

In reply to Bart Van Assche

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]

Cc Quinn Tran <[email protected]>
Cc Himanshu Madhani <[email protected]>
Cc Johannes Thumshirn <[email protected]>
Cc Christoph Hellwig <[email protected]>
---
 drivers/scsi/qla2xxx/qla_target.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_target.c +2 -1
index 7158f9d..87b301d 100644
@@ -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;
 	}
 
Signature · 1 line
2.7.4