[PATCH] scsi: target: fix spelling mistake "Uknown" -> "Unknown"

2018-05-26 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in pr_err message text

Signed-off-by: Colin Ian King 
---
 drivers/target/target_core_transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_transport.c 
b/drivers/target/target_core_transport.c
index bde14f46ed5b..f0e8f0f4ccb4 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -3366,7 +3366,7 @@ static void target_tmr_work(struct work_struct *work)
tmr->response = TMR_FUNCTION_REJECTED;
break;
default:
-   pr_err("Uknown TMR function: 0x%02x.\n",
+   pr_err("Unknown TMR function: 0x%02x.\n",
tmr->function);
tmr->response = TMR_FUNCTION_REJECTED;
break;
-- 
2.17.0



[PATCH] scsi: pm80xx: fix spelling mistake "UNSORPORTED" -> "SUPPORTED"

2018-05-26 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in pm8001_printk message text; also
I believe NOT_UNSUPPORTED should probably be NOT_SUPPORTED. Also
fix the indent of the pm8001_printk statement.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/pm8001/pm8001_hwi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index db88a8e7ee0e..4dd6cad330e8 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -3607,7 +3607,7 @@ int pm8001_mpi_reg_resp(struct pm8001_hba_info 
*pm8001_ha, void *piomb)
break;
default:
PM8001_MSG_DBG(pm8001_ha,
-pm8001_printk("DEVREG_FAILURE_DEVICE_TYPE_NOT_UNSORPORTED\n"));
+   
pm8001_printk("DEVREG_FAILURE_DEVICE_TYPE_NOT_SUPPORTED\n"));
break;
}
complete(pm8001_dev->dcompletion);
-- 
2.17.0



[PATCH] scsi: snic: fix a couple of spelling mistakes: "COMPLETE"

2018-05-17 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistakes/typos:
"SNIC_IOREQ_ABTS_COMPELTE" -> "SNIC_IOREQ_ABTS_COMPLETE"
"SNIC_IOREQ_LR_COMPELTE"   -> "SNIC_IOREQ_LR_COMPLETE"
"SNIC_IOREQ_CMD_COMPELTE"  -> "SNIC_IOREQ_CMD_COMPLETE"

Signed-off-by: Colin Ian King 
---
 drivers/scsi/snic/snic_scsi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/snic/snic_scsi.c b/drivers/scsi/snic/snic_scsi.c
index d8a376b7882d..d9b2e46424aa 100644
--- a/drivers/scsi/snic/snic_scsi.c
+++ b/drivers/scsi/snic/snic_scsi.c
@@ -47,10 +47,10 @@ static const char * const snic_req_state_str[] = {
[SNIC_IOREQ_NOT_INITED] = "SNIC_IOREQ_NOT_INITED",
[SNIC_IOREQ_PENDING]= "SNIC_IOREQ_PENDING",
[SNIC_IOREQ_ABTS_PENDING] = "SNIC_IOREQ_ABTS_PENDING",
-   [SNIC_IOREQ_ABTS_COMPLETE] = "SNIC_IOREQ_ABTS_COMPELTE",
+   [SNIC_IOREQ_ABTS_COMPLETE] = "SNIC_IOREQ_ABTS_COMPLETE",
[SNIC_IOREQ_LR_PENDING] = "SNIC_IOREQ_LR_PENDING",
-   [SNIC_IOREQ_LR_COMPLETE] = "SNIC_IOREQ_LR_COMPELTE",
-   [SNIC_IOREQ_COMPLETE]   = "SNIC_IOREQ_CMD_COMPELTE",
+   [SNIC_IOREQ_LR_COMPLETE] = "SNIC_IOREQ_LR_COMPLETE",
+   [SNIC_IOREQ_COMPLETE]   = "SNIC_IOREQ_CMD_COMPLETE",
 };
 
 /* snic cmd status strings */
-- 
2.17.0



[PATCH] scsi: esas2r: fix spelling mistake: "requestss" -> "requests"

2018-05-08 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in esas2r_debug message

Signed-off-by: Colin Ian King 
---
 drivers/scsi/esas2r/esas2r_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c 
b/drivers/scsi/esas2r/esas2r_ioctl.c
index 97623002908f..34bcc8c04ff4 100644
--- a/drivers/scsi/esas2r/esas2r_ioctl.c
+++ b/drivers/scsi/esas2r/esas2r_ioctl.c
@@ -1849,7 +1849,7 @@ int esas2r_read_vda(struct esas2r_adapter *a, char *buf, 
long off, int count)
/* allocate a request */
rq = esas2r_alloc_request(a);
if (rq == NULL) {
-   esas2r_debug("esas2r_read_vda: out of requestss");
+   esas2r_debug("esas2r_read_vda: out of requests");
return -EBUSY;
}
 
-- 
2.17.0



[PATCH] scsi: mptsas: fix spelling mistake: "matchs" -> "matches"

2018-05-03 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in warning message

Signed-off-by: Colin Ian King 
---
 drivers/message/fusion/mptsas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 86503f60468f..9a21ce6ee7d0 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -4320,7 +4320,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, struct 
fw_event_work *fw_event,
if (ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID ==
hot_plug_info->id) {
printk(MYIOC_s_WARN_FMT "firmware bug: unable "
-   "to add hidden disk - target_id matchs "
+   "to add hidden disk - target_id matches "
"volume_id\n", ioc->name);
mptsas_free_fw_event(ioc, fw_event);
return;
-- 
2.17.0



[PATCH][V2] scsi: lpfc: fix spelling mistakes: "mabilbox" and "maibox"

2018-05-03 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistakes in lpfc_printf_log log message

"mabilbox" -> "mailbox"
"maibox" -> "mailbox"

Signed-off-by: Colin Ian King 
---

V2: Add maibox fixes

---
 drivers/scsi/lpfc/lpfc_bsg.c  | 20 ++--
 drivers/scsi/lpfc/lpfc_init.c |  4 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 0f174ca80f67..edb1a18a6414 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -3621,7 +3621,7 @@ lpfc_bsg_issue_mbox_ext_handle_job(struct lpfc_hba *phba, 
LPFC_MBOXQ_t *pmboxq)
bsg_reply->result = 0;
 
lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC,
-   "2937 SLI_CONFIG ext-buffer maibox command "
+   "2937 SLI_CONFIG ext-buffer mailbox command "
"(x%x/x%x) complete bsg job done, bsize:%d\n",
phba->mbox_ext_buf_ctx.nembType,
phba->mbox_ext_buf_ctx.mboxType, size);
@@ -3632,7 +3632,7 @@ lpfc_bsg_issue_mbox_ext_handle_job(struct lpfc_hba *phba, 
LPFC_MBOXQ_t *pmboxq)
phba->mbox_ext_buf_ctx.mbx_dmabuf, 0);
} else {
lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC,
-   "2938 SLI_CONFIG ext-buffer maibox "
+   "2938 SLI_CONFIG ext-buffer mailbox "
"command (x%x/x%x) failure, rc:x%x\n",
phba->mbox_ext_buf_ctx.nembType,
phba->mbox_ext_buf_ctx.mboxType, rc);
@@ -3666,7 +3666,7 @@ lpfc_bsg_issue_read_mbox_ext_cmpl(struct lpfc_hba *phba, 
LPFC_MBOXQ_t *pmboxq)
pmboxq->u.mb.mbxStatus = MBXERR_ERROR;
 
lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC,
-   "2939 SLI_CONFIG ext-buffer rd maibox command "
+   "2939 SLI_CONFIG ext-buffer rd mailbox command "
"complete, ctxState:x%x, mbxStatus:x%x\n",
phba->mbox_ext_buf_ctx.state, pmboxq->u.mb.mbxStatus);
 
@@ -3706,7 +3706,7 @@ lpfc_bsg_issue_write_mbox_ext_cmpl(struct lpfc_hba *phba, 
LPFC_MBOXQ_t *pmboxq)
pmboxq->u.mb.mbxStatus = MBXERR_ERROR;
 
lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC,
-   "2940 SLI_CONFIG ext-buffer wr maibox command "
+   "2940 SLI_CONFIG ext-buffer wr mailbox command "
"complete, ctxState:x%x, mbxStatus:x%x\n",
phba->mbox_ext_buf_ctx.state, pmboxq->u.mb.mbxStatus);
 
@@ -3988,12 +3988,12 @@ lpfc_bsg_sli_cfg_read_cmd_ext(struct lpfc_hba *phba, 
struct bsg_job *job,
if ((rc == MBX_SUCCESS) || (rc == MBX_BUSY)) {
lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC,
"2947 Issued SLI_CONFIG ext-buffer "
-   "maibox command, rc:x%x\n", rc);
+   "mailbox command, rc:x%x\n", rc);
return SLI_CONFIG_HANDLED;
}
lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC,
"2948 Failed to issue SLI_CONFIG ext-buffer "
-   "maibox command, rc:x%x\n", rc);
+   "mailbox command, rc:x%x\n", rc);
rc = -EPIPE;
 
 job_error:
@@ -4147,12 +4147,12 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, 
struct bsg_job *job,
if ((rc == MBX_SUCCESS) || (rc == MBX_BUSY)) {
lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC,
"2955 Issued SLI_CONFIG ext-buffer "
-   "maibox command, rc:x%x\n", rc);
+   "mailbox command, rc:x%x\n", rc);
return SLI_CONFIG_HANDLED;
}
lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC,
"2956 Failed to issue SLI_CONFIG ext-buffer "
-   "maibox command, rc:x%x\n", rc);
+   "mailbox command, rc:x%x\n", rc);
rc = -EPIPE;
goto job_error;
}
@@ -4492,12 +4492,12 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct 
bsg_job *job,
if ((rc == MBX_SUCCESS) || (rc == MBX_BUSY)) {
lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC,
"2969 Issued SLI_CONFIG ext-buffer "
-   "maibox command, rc:x%x\n", rc);
+   "mailbox command, rc:x%x\n", rc);
return SLI_CONFIG_HANDLED;
}
lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC,
"2970 

[PATCH] scsi: lpfc: fix spelling mistake: "mabilbox" -> "mailbox"

2018-05-03 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in lpfc_printf_log log message

Signed-off-by: Colin Ian King 
---
 drivers/scsi/lpfc/lpfc_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 060f0e2f6ff5..dc4334fa41bb 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -5117,7 +5117,7 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
if (rc) {
lpfc_printf_log(phba, KERN_ERR, LOG_FIP |
LOG_DISCOVERY,
-   "2772 Issue FCF rediscover mabilbox "
+   "2772 Issue FCF rediscover mailbox "
"command failed, fail through to FCF "
"dead event\n");
spin_lock_irq(>hbalock);
@@ -5209,7 +5209,7 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
lpfc_printf_log(phba, KERN_ERR, LOG_FIP |
LOG_DISCOVERY,
"2774 Issue FCF rediscover "
-   "mabilbox command failed, "
+   "mailbox command failed, "
"through to CVL event\n");
spin_lock_irq(>hbalock);
phba->fcf.fcf_flag &= ~FCF_ACVL_DISC;
-- 
2.17.0



[PATCH] scsi: mptfusion: fix spelling mistake: "initators" -> "initiators"

2018-05-02 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in text string

Signed-off-by: Colin Ian King 
---
 drivers/message/fusion/mptbase.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 51eb1b027963..72e72f93f0f5 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -7635,7 +7635,7 @@ mpt_display_event_info(MPT_ADAPTER *ioc, 
EventNotificationReply_t *pEventReply)
 
snprintf(evStr, EVENT_DESCR_STR_SZ,
"SAS Initiator Device Table Overflow: max initiators=%02d "
-   "current initators=%02d",
+   "current initiators=%02d",
max_init, current_init);
break;
}
-- 
2.17.0



[PATCH] scsi: mpt3sas: fix spelling mistake: "disbale" -> "disable"

2018-04-29 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in module parameter description text

Signed-off-by: Colin Ian King 
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 61f93a134956..4edf1fc0e80c 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -87,7 +87,7 @@ MODULE_PARM_DESC(msix_disable, " disable msix routed 
interrupts (default=0)");
 
 static int smp_affinity_enable = 1;
 module_param(smp_affinity_enable, int, S_IRUGO);
-MODULE_PARM_DESC(smp_affinity_enable, "SMP affinity feature enable/disbale 
Default: enable(1)");
+MODULE_PARM_DESC(smp_affinity_enable, "SMP affinity feature enable/disable 
Default: enable(1)");
 
 static int max_msix_vectors = -1;
 module_param(max_msix_vectors, int, 0);
-- 
2.17.0



[PATCH] scsi: megaraid_sas: fix spelling mistake: "disbale" -> "disable"

2018-04-29 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in module parameter description text

Signed-off-by: Colin Ian King 
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 026fad818b2a..55c38bcf3c73 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -92,7 +92,7 @@ MODULE_PARM_DESC(resetwaittime, "Wait time in seconds after 
I/O timeout "
 
 int smp_affinity_enable = 1;
 module_param(smp_affinity_enable, int, S_IRUGO);
-MODULE_PARM_DESC(smp_affinity_enable, "SMP affinity feature enable/disbale 
Default: enable(1)");
+MODULE_PARM_DESC(smp_affinity_enable, "SMP affinity feature enable/disable 
Default: enable(1)");
 
 int rdpq_enable = 1;
 module_param(rdpq_enable, int, S_IRUGO);
-- 
2.17.0



[PATCH] scsi: esas2r: fix spelling mistake: "asynchromous" -> "asynchronous"

2018-04-27 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in module description text

Signed-off-by: Colin Ian King 
---
 drivers/scsi/esas2r/esas2r_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/esas2r/esas2r_main.c 
b/drivers/scsi/esas2r/esas2r_main.c
index e07eac5be087..c07118617d89 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -283,7 +283,7 @@ MODULE_PARM_DESC(num_requests,
 int num_ae_requests = 4;
 module_param(num_ae_requests, int, 0);
 MODULE_PARM_DESC(num_ae_requests,
-"Number of VDA asynchromous event requests.  Default 4.");
+"Number of VDA asynchronous event requests.  Default 4.");
 
 int cmd_per_lun = ESAS2R_DEFAULT_CMD_PER_LUN;
 module_param(cmd_per_lun, int, 0);
-- 
2.17.0



[PATCH] scsi: isci: remove redundant check on in_connection_align_insertion_frequency

2018-04-25 Thread Colin King
From: Colin Ian King 

The sanity check on u->in_connection_align_insertion_frequency is being
performed twice and hence the first check can be removed since it is
redundant. Cleans up cppcheck warning:

drivers/scsi/ibmvscsi/ibmvscsi.c:1711: (warning) Identical inner 'if'
condition is always true.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/isci/init.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 922e3e56c90d..05cf4daf8788 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -433,9 +433,6 @@ static enum sci_status sci_user_parameters_set(struct 
isci_host *ihost,
  (u->max_speed_generation > SCIC_SDS_PARM_NO_SPEED)))
return SCI_FAILURE_INVALID_PARAMETER_VALUE;
 
-   if (u->in_connection_align_insertion_frequency < 3)
-   return SCI_FAILURE_INVALID_PARAMETER_VALUE;
-
if ((u->in_connection_align_insertion_frequency < 3) ||
(u->align_insertion_frequency == 0) ||
(u->notify_enable_spin_up_insertion_frequency == 0))
-- 
2.17.0



[PATCH][V2] isci: Fix infinite loop in while loop

2018-04-20 Thread Colin King
From: Colin Ian King 

In the case when the phy_mask is bitwise anded with the
phy_index bit is zero the continue statement currently jumps
to the next iteration of the while loop and phy_index is
never actually incremented, potentially causing an infinite
loop if phy_index is less than SCI_MAX_PHS. Fix this by turning
the while loop into a for loop.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/isci/port_config.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/isci/port_config.c b/drivers/scsi/isci/port_config.c
index edb7be786c65..9e8de1462593 100644
--- a/drivers/scsi/isci/port_config.c
+++ b/drivers/scsi/isci/port_config.c
@@ -291,7 +291,7 @@ sci_mpc_agent_validate_phy_configuration(struct isci_host 
*ihost,
 * Note: We have not moved the current phy_index so we will 
actually
 *   compare the startting phy with itself.
 *   This is expected and required to add the phy to the 
port. */
-   while (phy_index < SCI_MAX_PHYS) {
+   for (; phy_index < SCI_MAX_PHYS; phy_index++) {
if ((phy_mask & (1 << phy_index)) == 0)
continue;
sci_phy_get_sas_address(>phys[phy_index],
@@ -311,7 +311,6 @@ sci_mpc_agent_validate_phy_configuration(struct isci_host 
*ihost,
  >phys[phy_index]);
 
assigned_phy_mask |= (1 << phy_index);
-   phy_index++;
}
 
}
-- 
2.17.0



[PATCH] isci: Fix infinite loop in while loop

2018-04-20 Thread Colin King
From: Colin Ian King 

In the case when the phy_mask is bitwise anded with the
phy_index bit is zero the continue statement currently jumps
to the next iteration of the while loop and phy_index is
never actually incremented, potentially causing an infinite
loop if phy_index is less than SCI_MAX_PHS. Fix this by
jumping to the increment of phy_index.

[ The goto is used to save one more level of nesting that
makes the code far wider than 80 columns. ]

Fixes: 80aebef7c112 ("[SCSI] isci: Fix a infinite loop.")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/isci/port_config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/isci/port_config.c b/drivers/scsi/isci/port_config.c
index edb7be786c65..55dc7c1dbc2b 100644
--- a/drivers/scsi/isci/port_config.c
+++ b/drivers/scsi/isci/port_config.c
@@ -293,7 +293,7 @@ sci_mpc_agent_validate_phy_configuration(struct isci_host 
*ihost,
 *   This is expected and required to add the phy to the 
port. */
while (phy_index < SCI_MAX_PHYS) {
if ((phy_mask & (1 << phy_index)) == 0)
-   continue;
+   goto next_index;
sci_phy_get_sas_address(>phys[phy_index],
 _assigned_address);
 
@@ -311,6 +311,7 @@ sci_mpc_agent_validate_phy_configuration(struct isci_host 
*ihost,
  >phys[phy_index]);
 
assigned_phy_mask |= (1 << phy_index);
+next_index:
phy_index++;
}
 
-- 
2.17.0



[PATCH] scsi: mptfc: fix spelling mistake in macro names

2018-04-18 Thread Colin King
From: Colin Ian King 

Rename macros MPI_FCPORTPAGE0_SUPPORT_SPEED_UKNOWN and
MPI_FCPORTPAGE0_CURRENT_SPEED_UKNOWN to add in missing N in UNKNOWN

Signed-off-by: Colin Ian King 
---
 drivers/message/fusion/lsi/mpi_cnfg.h | 4 ++--
 drivers/message/fusion/mptfc.c| 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/message/fusion/lsi/mpi_cnfg.h 
b/drivers/message/fusion/lsi/mpi_cnfg.h
index 4e9c0ce94f27..059997f8ebce 100644
--- a/drivers/message/fusion/lsi/mpi_cnfg.h
+++ b/drivers/message/fusion/lsi/mpi_cnfg.h
@@ -1802,13 +1802,13 @@ typedef struct _CONFIG_PAGE_FC_PORT_0
 #define MPI_FCPORTPAGE0_SUPPORT_CLASS_2 (0x0002)
 #define MPI_FCPORTPAGE0_SUPPORT_CLASS_3 (0x0004)
 
-#define MPI_FCPORTPAGE0_SUPPORT_SPEED_UKNOWN(0x) /* 
(SNIA)HBA_PORTSPEED_UNKNOWN 0   Unknown - transceiver incapable of reporting */
+#define MPI_FCPORTPAGE0_SUPPORT_SPEED_UNKNOWN   (0x) /* 
(SNIA)HBA_PORTSPEED_UNKNOWN 0   Unknown - transceiver incapable of reporting */
 #define MPI_FCPORTPAGE0_SUPPORT_1GBIT_SPEED (0x0001) /* 
(SNIA)HBA_PORTSPEED_1GBIT   1   1 GBit/sec */
 #define MPI_FCPORTPAGE0_SUPPORT_2GBIT_SPEED (0x0002) /* 
(SNIA)HBA_PORTSPEED_2GBIT   2   2 GBit/sec */
 #define MPI_FCPORTPAGE0_SUPPORT_10GBIT_SPEED(0x0004) /* 
(SNIA)HBA_PORTSPEED_10GBIT  4  10 GBit/sec */
 #define MPI_FCPORTPAGE0_SUPPORT_4GBIT_SPEED (0x0008) /* 
(SNIA)HBA_PORTSPEED_4GBIT   8   4 GBit/sec */
 
-#define MPI_FCPORTPAGE0_CURRENT_SPEED_UKNOWN
MPI_FCPORTPAGE0_SUPPORT_SPEED_UKNOWN
+#define MPI_FCPORTPAGE0_CURRENT_SPEED_UNKNOWN   
MPI_FCPORTPAGE0_SUPPORT_SPEED_UNKNOWN
 #define MPI_FCPORTPAGE0_CURRENT_SPEED_1GBIT 
MPI_FCPORTPAGE0_SUPPORT_1GBIT_SPEED
 #define MPI_FCPORTPAGE0_CURRENT_SPEED_2GBIT 
MPI_FCPORTPAGE0_SUPPORT_2GBIT_SPEED
 #define MPI_FCPORTPAGE0_CURRENT_SPEED_10GBIT
MPI_FCPORTPAGE0_SUPPORT_10GBIT_SPEED
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 6d461ca97150..06b175420be9 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -693,7 +693,7 @@ mptfc_display_port_link_speed(MPT_ADAPTER *ioc, int 
portnum, FCPortPage0_t *pp0d
state = pp0dest->PortState;
 
if (state != MPI_FCPORTPAGE0_PORTSTATE_OFFLINE &&
-   new_speed != MPI_FCPORTPAGE0_CURRENT_SPEED_UKNOWN) {
+   new_speed != MPI_FCPORTPAGE0_CURRENT_SPEED_UNKNOWN) {
 
old = old_speed == MPI_FCPORTPAGE0_CURRENT_SPEED_1GBIT ? "1 
Gbps" :
   old_speed == MPI_FCPORTPAGE0_CURRENT_SPEED_2GBIT ? "2 
Gbps" :
-- 
2.17.0



[PATCH][next] scsi: fnic: fix spelling mistake in fnic stats "Abord" -> "Abort"

2018-04-11 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in fnic stats message text

Signed-off-by: Colin Ian King 
---
 drivers/scsi/fnic/fnic_trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c
index abddde11982b..98597b59c12a 100644
--- a/drivers/scsi/fnic/fnic_trace.c
+++ b/drivers/scsi/fnic/fnic_trace.c
@@ -296,7 +296,7 @@ int fnic_get_stats_data(struct stats_debug_info *debug,
  "Number of Abort FW Timeouts: %lld\n"
  "Number of Abort IO NOT Found: %lld\n"
 
- "Abord issued times: \n"
+ "Abort issued times: \n"
  "< 6 sec : %lld\n"
  " 6 sec - 20 sec : %lld\n"
  "20 sec - 30 sec : %lld\n"
-- 
2.15.1



[PATCH][scsi-next] scsi: core: remove redundant assignment to shost->use_blk_mq

2018-03-28 Thread Colin King
From: Colin Ian King 

The first assignment to shost->use_blk_mq is redundant as it is
overwritten by the following statement. Remove this redundant code.

Detected by CoverityScan, CID#1466993 ("Unused value")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/hosts.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 7649d63a1b8d..3771e59a9fae 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -472,7 +472,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template 
*sht, int privsize)
else
shost->dma_boundary = 0x;
 
-   shost->use_blk_mq = scsi_use_blk_mq;
shost->use_blk_mq = scsi_use_blk_mq || shost->hostt->force_blk_mq;
 
device_initialize(>shost_gendev);
-- 
2.15.1



[PATCH] scsi: fnic: fix spelling mistake: "abord" -> "abort"

2018-03-28 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in message text

Signed-off-by: Colin Ian King 
---
 drivers/scsi/fnic/fnic_trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c
index abddde11982b..98597b59c12a 100644
--- a/drivers/scsi/fnic/fnic_trace.c
+++ b/drivers/scsi/fnic/fnic_trace.c
@@ -296,7 +296,7 @@ int fnic_get_stats_data(struct stats_debug_info *debug,
  "Number of Abort FW Timeouts: %lld\n"
  "Number of Abort IO NOT Found: %lld\n"
 
- "Abord issued times: \n"
+ "Abort issued times: \n"
  "< 6 sec : %lld\n"
  " 6 sec - 20 sec : %lld\n"
  "20 sec - 30 sec : %lld\n"
-- 
2.15.1



[PATCH][next] scsi: lpfc: make several unions static, fix non-ANSI prototype

2018-03-13 Thread Colin King
From: Colin Ian King 

There are several unions that are local to the source and do not need
to be in global scope, so make them static. Also add in a missing void
parameter to functions lpfc_nvme_cmd_template and
lpfc_nvmet_cmd_template to clean up non-ANSI warning.

Cleans up sparse warnings:
drivers/scsi/lpfc/lpfc_nvme.c:68:19: warning: symbol
'lpfc_iread_cmd_template' was not declared. Should it be static?
drivers/scsi/lpfc/lpfc_nvme.c:69:19: warning: symbol
'lpfc_iwrite_cmd_template' was not declared. Should it be static?
drivers/scsi/lpfc/lpfc_nvme.c:70:19: warning: symbol
'lpfc_icmnd_cmd_template' was not declared. Should it be static?
drivers/scsi/lpfc/lpfc_nvme.c:74:24: warning: non-ANSI function
'lpfc_tsend_cmd_template' was not declared. Should it be static?
drivers/scsi/lpfc/lpfc_nvmet.c:78:19: warning: symbol
'lpfc_treceive_cmd_template' was not declared. Should it be static?
drivers/scsi/lpfc/lpfc_nvmet.c:79:19: warning: symbol
'lpfc_trsp_cmd_template' was not declared. Should it be static?
drivers/scsi/lpfc/lpfc_nvmet.c:83:25: warning: non-ANSI function
declaration of function 'lpfc_nvmet_cmd_template'

Signed-off-by: Colin Ian King 
---
 drivers/scsi/lpfc/lpfc_nvme.c  | 8 
 drivers/scsi/lpfc/lpfc_nvmet.c | 8 
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
index 52dd9479b538..378dca40ca20 100644
--- a/drivers/scsi/lpfc/lpfc_nvme.c
+++ b/drivers/scsi/lpfc/lpfc_nvme.c
@@ -65,13 +65,13 @@ lpfc_release_nvme_buf(struct lpfc_hba *, struct 
lpfc_nvme_buf *);
 
 static struct nvme_fc_port_template lpfc_nvme_template;
 
-union lpfc_wqe128 lpfc_iread_cmd_template;
-union lpfc_wqe128 lpfc_iwrite_cmd_template;
-union lpfc_wqe128 lpfc_icmnd_cmd_template;
+static union lpfc_wqe128 lpfc_iread_cmd_template;
+static union lpfc_wqe128 lpfc_iwrite_cmd_template;
+static union lpfc_wqe128 lpfc_icmnd_cmd_template;
 
 /* Setup WQE templates for NVME IOs */
 void
-lpfc_nvme_cmd_template()
+lpfc_nvme_cmd_template(void)
 {
union lpfc_wqe128 *wqe;
 
diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c
index 07f89524c320..7271c9d885dd 100644
--- a/drivers/scsi/lpfc/lpfc_nvmet.c
+++ b/drivers/scsi/lpfc/lpfc_nvmet.c
@@ -74,13 +74,13 @@ static int lpfc_nvmet_unsol_ls_issue_abort(struct lpfc_hba 
*,
 static void lpfc_nvmet_wqfull_flush(struct lpfc_hba *, struct lpfc_queue *,
struct lpfc_nvmet_rcv_ctx *);
 
-union lpfc_wqe128 lpfc_tsend_cmd_template;
-union lpfc_wqe128 lpfc_treceive_cmd_template;
-union lpfc_wqe128 lpfc_trsp_cmd_template;
+static union lpfc_wqe128 lpfc_tsend_cmd_template;
+static union lpfc_wqe128 lpfc_treceive_cmd_template;
+static union lpfc_wqe128 lpfc_trsp_cmd_template;
 
 /* Setup WQE templates for NVME IOs */
 void
-lpfc_nvmet_cmd_template()
+lpfc_nvmet_cmd_template(void)
 {
union lpfc_wqe128 *wqe;
 
-- 
2.15.1



[PATCH] scsi: scsi_transport_spi make two const arrays static, shrinks object size

2018-02-14 Thread Colin King
From: Colin Ian King 

Don't populate the const read-only arrays spi_test_unit_ready and
spi_test_unit_ready on the stack but instead make them static. Makes the
object code smaller by over 100 bytes:

Before:
   textdata bss dec hex filename
  40171   12832 128   53131cf8b drivers/scsi/scsi_transport_spi.o

After:
   textdata bss dec hex filename
  39922   12976 128   53026cf22 drivers/scsi/scsi_transport_spi.o

(gcc version 7.2.0 x86_64)

Signed-off-by: Colin Ian King 
---
 drivers/scsi/scsi_transport_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_transport_spi.c 
b/drivers/scsi/scsi_transport_spi.c
index 871ea582029e..2ca150b16764 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -822,11 +822,11 @@ spi_dv_device_get_echo_buffer(struct scsi_device *sdev, 
u8 *buffer)
 * fails, the device won't let us write to the echo buffer
 * so just return failure */

-   const char spi_test_unit_ready[] = {
+   static const char spi_test_unit_ready[] = {
TEST_UNIT_READY, 0, 0, 0, 0, 0
};
 
-   const char spi_read_buffer_descriptor[] = {
+   static const char spi_read_buffer_descriptor[] = {
READ_BUFFER, 0x0b, 0, 0, 0, 0, 0, 0, 4, 0
};
 
-- 
2.15.1



[PATCH][scsi-next] scsi: myrb: remove shadowed and unassigned variable ldev_num

2018-02-14 Thread Colin King
From: Colin Ian King 

A lower-scoped variable ldev_num is never assigned and is shadowing
the higher scoped iterator ldev_num and should be removed to avoid
using garbage ldev_num values.

Detected by CoverityScan, CID#1465226 ("Uninitialized scalar variable")

Fixes: dd47c1072226 ("scsi: myrb: Add Mylex RAID controller (block interface)")
Signed-off-by: Colin Ian King 
---
 drivers/scsi/myrb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/myrb.c b/drivers/scsi/myrb.c
index 973a2250208f..65ade4d37b33 100644
--- a/drivers/scsi/myrb.c
+++ b/drivers/scsi/myrb.c
@@ -422,7 +422,6 @@ static unsigned short myrb_get_ldev_info(myrb_hba *cb)
myrb_ldev_info *old = NULL;
myrb_ldev_info *new = cb->ldev_info_buf[ldev_num];
struct scsi_device *sdev;
-   unsigned short ldev_num;
myrb_devstate old_state = DAC960_V1_Device_Offline;
 
sdev = scsi_device_lookup(shost, myrb_logical_channel(shost),
-- 
2.15.1



[PATCH][scsi-next] scsi: myrs: ensure sge_count is set correctly

2018-02-14 Thread Colin King
From: Colin Ian King 

The DMA size is not being assigned to sge_count, instead sge_addr is
being assigned this value, which is incorrected.

Detected by CoverityScan, CID#1465233 ("Unused value")

Fixes: 8a8606895947 ("scsi: myrs: Add Mylex RAID controller (SCSI interface)")
Signed-off-by: Colin Ian King 
---
 drivers/scsi/myrs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
index 16498e1b0dd4..eb67ed3a7cff 100644
--- a/drivers/scsi/myrs.c
+++ b/drivers/scsi/myrs.c
@@ -442,7 +442,7 @@ myrs_translate_pdev(myrs_hba *cs, unsigned char channel,
DAC960_V2_TranslatePhysicalToLogicalDevice;
sgl = >PhysicalDeviceInfo.dma_addr;
sgl->sge[0].sge_addr = devmap_addr;
-   sgl->sge[0].sge_addr = mbox->PhysicalDeviceInfo.dma_size;
+   sgl->sge[0].sge_count = mbox->PhysicalDeviceInfo.dma_size;
 
myrs_exec_cmd(cs, cmd_blk);
status = cmd_blk->status;
-- 
2.15.1



[PATCH][scsi-next] scsi: myrs: Fix spelling mistake: "Cashe"-> "Cache"

2018-02-14 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in info message text.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/myrs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
index 3b87c6942a8e..16498e1b0dd4 100644
--- a/drivers/scsi/myrs.c
+++ b/drivers/scsi/myrs.c
@@ -1571,7 +1571,7 @@ static ssize_t myrs_store_flush_cache(struct device *dev,
return count;
}
shost_printk(KERN_INFO, shost,
-"Cashe Flush failed, status 0x%02x\n", status);
+"Cache Flush failed, status 0x%02x\n", status);
return -EIO;
 }
 static DEVICE_ATTR(flush_cache, S_IWUSR, NULL, myrs_store_flush_cache);
-- 
2.15.1



[PATCH] scsi: pmcraid: remove redundant initializations of pointer 'ioadl'

2018-02-06 Thread Colin King
From: Colin Ian King 

There are several occurrances where pointer ioadl is initialized with a
value that is never read and where it is re-assigned a new value later
on, hence the initialization is redundant and can be removed.

Cleans up clang warnings:
drivers/scsi/pmcraid.c:1028:29: warning: Value stored to 'ioadl' during
its initialization is never read
drivers/scsi/pmcraid.c:3178:29: warning: Value stored to 'ioadl' during
its initialization is never read
drivers/scsi/pmcraid.c:5495:29: warning: Value stored to 'ioadl' during
its initialization is never read
drivers/scsi/pmcraid.c:5668:29: warning: Value stored to 'ioadl' during
its initialization is never read

Signed-off-by: Colin Ian King 
---
 drivers/scsi/pmcraid.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 201c8de1853d..9330cc5ba34d 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -1025,7 +1025,7 @@ static void pmcraid_get_fwversion_done(struct pmcraid_cmd 
*cmd)
 static void pmcraid_get_fwversion(struct pmcraid_cmd *cmd)
 {
struct pmcraid_ioarcb *ioarcb = >ioa_cb->ioarcb;
-   struct pmcraid_ioadl_desc *ioadl = ioarcb->add_data.u.ioadl;
+   struct pmcraid_ioadl_desc *ioadl;
struct pmcraid_instance *pinstance = cmd->drv_inst;
u16 data_size = sizeof(struct pmcraid_inquiry_data);
 
@@ -3175,7 +3175,7 @@ static int pmcraid_build_ioadl(
 
struct scsi_cmnd *scsi_cmd = cmd->scsi_cmd;
struct pmcraid_ioarcb *ioarcb = &(cmd->ioa_cb->ioarcb);
-   struct pmcraid_ioadl_desc *ioadl = ioarcb->add_data.u.ioadl;
+   struct pmcraid_ioadl_desc *ioadl;
 
u32 length = scsi_bufflen(scsi_cmd);
 
@@ -5492,7 +5492,7 @@ static void pmcraid_set_timestamp(struct pmcraid_cmd *cmd)
struct pmcraid_instance *pinstance = cmd->drv_inst;
struct pmcraid_ioarcb *ioarcb = >ioa_cb->ioarcb;
__be32 time_stamp_len = cpu_to_be32(PMCRAID_TIMESTAMP_LEN);
-   struct pmcraid_ioadl_desc *ioadl = ioarcb->add_data.u.ioadl;
+   struct pmcraid_ioadl_desc *ioadl;
u64 timestamp;
 
timestamp = ktime_get_real_seconds() * 1000;
@@ -5665,7 +5665,7 @@ static void pmcraid_init_res_table(struct pmcraid_cmd 
*cmd)
 static void pmcraid_querycfg(struct pmcraid_cmd *cmd)
 {
struct pmcraid_ioarcb *ioarcb = >ioa_cb->ioarcb;
-   struct pmcraid_ioadl_desc *ioadl = ioarcb->add_data.u.ioadl;
+   struct pmcraid_ioadl_desc *ioadl;
struct pmcraid_instance *pinstance = cmd->drv_inst;
__be32 cfg_table_size = cpu_to_be32(sizeof(struct 
pmcraid_config_table));
 
-- 
2.15.1



[PATCH] scsi: libfc: remove redundant initialization of 'disc'

2018-02-06 Thread Colin King
From: Colin Ian King 

Pointer disc is being intializated a value that is never read and then
re-assigned the same value later on, hence the initialization is redundant
and can be removed.

Cleans up clang warning:
drivers/scsi/libfc/fc_disc.c:734:18: warning: Value stored to 'disc'
during its initialization is never read

Signed-off-by: Colin Ian King 
---
 drivers/scsi/libfc/fc_disc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index 8660f923ace0..3f3569ec5ce3 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -731,7 +731,7 @@ static void fc_disc_stop_final(struct fc_lport *lport)
  */
 void fc_disc_config(struct fc_lport *lport, void *priv)
 {
-   struct fc_disc *disc = >disc;
+   struct fc_disc *disc;
 
if (!lport->tt.disc_start)
lport->tt.disc_start = fc_disc_start;
-- 
2.15.1



[PATCH] scsi: isci: remove redundant initialization to 'bit'

2018-02-06 Thread Colin King
From: Colin Ian King 

Variable bit is initialized with a value that is never read and is
being updated immediately after the initialization, hence the
initialization is redundant and can be removed.

Cleans up clang warning:
drivers/scsi/isci/host.c:2769:8: warning: Value stored to 'bit' during
its initialization is never read

Signed-off-by: Colin Ian King 
---
 drivers/scsi/isci/host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index 13b37cdffa8e..1ee3868ade07 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -2766,7 +2766,7 @@ static int sci_write_gpio_tx_gp(struct isci_host *ihost, 
u8 reg_index, u8 reg_co
int i;
 
for (i = 0; i < 3; i++) {
-   int bit = (i << 2) + 2;
+   int bit;
 
bit = try_test_sas_gpio_gp_bit(to_sas_gpio_od(d, i),
   write_data, reg_index,
-- 
2.15.1



[PATCH] scsi: qedf: remove redundant initialization of 'fcport'

2018-02-06 Thread Colin King
From: Colin Ian King 

Pointer fcport is initialized with a value that is never read, it is
re-assigned a new value later on, hence the initialization is redundant
and can be removed.

Cleans up clang warning:
drivers/scsi/qedf/qedf_io.c:920:21: warning: Value stored to 'fcport'
during its initialization is never read

Signed-off-by: Colin Ian King 
---
 drivers/scsi/qedf/qedf_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c
index b15e69586a36..50a50c4249d0 100644
--- a/drivers/scsi/qedf/qedf_io.c
+++ b/drivers/scsi/qedf/qedf_io.c
@@ -917,7 +917,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd 
*sc_cmd)
struct qedf_ctx *qedf = lport_priv(lport);
struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device));
struct fc_rport_libfc_priv *rp = rport->dd_data;
-   struct qedf_rport *fcport = rport->dd_data;
+   struct qedf_rport *fcport;
struct qedf_ioreq *io_req;
int rc = 0;
int rval;
-- 
2.15.1



[PATCH] scsi: csiostor: remove redundant assignment to pointer 'ln'

2018-01-24 Thread Colin King
From: Colin Ian King 

The pointer ln is assigned a value that is never read, it is re-assigned
a new value in the list_for_each loop hence the initialization is
redundant and can be removed.

Cleans up clang warning:
drivers/scsi/csiostor/csio_lnode.c:117:21: warning: Value stored to 'ln'
during its initialization is never read

Signed-off-by: Colin Ian King 
---
 drivers/scsi/csiostor/csio_lnode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/csiostor/csio_lnode.c 
b/drivers/scsi/csiostor/csio_lnode.c
index be5ee2d37815..7d81a1e7 100644
--- a/drivers/scsi/csiostor/csio_lnode.c
+++ b/drivers/scsi/csiostor/csio_lnode.c
@@ -114,7 +114,7 @@ static enum csio_ln_ev fwevt_to_lnevt[] = {
 static struct csio_lnode *
 csio_ln_lookup_by_portid(struct csio_hw *hw, uint8_t portid)
 {
-   struct csio_lnode *ln = hw->rln;
+   struct csio_lnode *ln;
struct list_head *tmp;
 
/* Match siblings lnode with portid */
-- 
2.15.1



[PATCH] scsi: mptsas: remove duplicated assignment to pointer head

2018-01-16 Thread Colin King
From: Colin Ian King 

The pointer head is re-assigned the same value twice, so remove the
second redundant assignment.

Cleans up clang warning:
drivers/message/fusion/mptsas.c:1161:20: warning: Value stored to 'head'
during its initialization is never read

Signed-off-by: Colin Ian King 
---
 drivers/message/fusion/mptsas.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 345f6035599e..439ee9c5f535 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1165,7 +1165,6 @@ mptsas_schedule_target_reset(void *iocp)
 * issue target reset to next device in the queue
 */
 
-   head = >target_reset_list;
if (list_empty(head))
return;
 
-- 
2.15.1



[PATCH][scsi-next] scsi: mpt3sas: make function _get_st_from_smid static

2018-01-11 Thread Colin King
From: Colin Ian King 

The function _get_st_from_smid is local to the source and does
not need to be in global scope, so make it static.

Cleans up sparse warning:
symbol '_get_st_from_smid' was not declared. Should it be static?

Signed-off-by: Colin Ian King 
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index a44b9be6e3c5..13d6e4ec3022 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -888,7 +888,7 @@ _base_async_event(struct MPT3SAS_ADAPTER *ioc, u8 
msix_index, u32 reply)
return 1;
 }
 
-struct scsiio_tracker *
+static struct scsiio_tracker *
 _get_st_from_smid(struct MPT3SAS_ADAPTER *ioc, u16 smid)
 {
struct scsi_cmnd *cmd;
-- 
2.15.1



[PATCH] scsi: bfa: use ARRAY_SIZE for array sizing calculation on array __pciids

2018-01-07 Thread Colin King
From: Colin Ian King 

Use the ARRAY_SIZE macro on array __pciids to determine size of the array.
Improvement suggested by coccinelle.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/bfa/bfa_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c
index 3e1caec82554..10a63be92544 100644
--- a/drivers/scsi/bfa/bfa_core.c
+++ b/drivers/scsi/bfa/bfa_core.c
@@ -1957,7 +1957,7 @@ bfa_get_pciids(struct bfa_pciid_s **pciids, int *npciids)
{BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_CT_FC},
};
 
-   *npciids = sizeof(__pciids) / sizeof(__pciids[0]);
+   *npciids = ARRAY_SIZE(__pciids);
*pciids = __pciids;
 }
 
-- 
2.15.1



[PATCH][scsi-next] scsi: qla2xxx: remove redundant assignment of d

2018-01-05 Thread Colin King
From: Colin Ian King 

The initialization of d is redundant as this value is never read
and it is overwritten inside the subsequent for-loop.  Remove this
redundant assignment.

Cleans up clang warning:
drivers/scsi/qla2xxx/qla_gs.c:3985:29: warning: Value stored to 'd'
during its initialization is never read

Signed-off-by: Colin Ian King 
---
 drivers/scsi/qla2xxx/qla_gs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index 6bfe24eeb402..f40ea8f120b7 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -3982,7 +3982,7 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, 
int res)
(struct ct_sns_req *)sp->u.iocb_cmd.u.ctarg.req;
struct ct_sns_gpnft_rsp *ct_rsp =
(struct ct_sns_gpnft_rsp *)sp->u.iocb_cmd.u.ctarg.rsp;
-   struct ct_sns_gpn_ft_data *d = _rsp->entries[0];
+   struct ct_sns_gpn_ft_data *d;
struct fab_scan_rp *rp;
int i, j, k;
u16 cmd = be16_to_cpu(ct_req->command);
-- 
2.15.1



[PATCH][scsi-next] scsi: aacraid: remove redundant setting of variable c

2018-01-05 Thread Colin King
From: Colin Ian King 

A previous commit no longer stores the contents of c, so we now have
a situation where c is being updated but the value is never read. Clean
up the code by removing the now redundant setting of variable c.

Cleans up clang warning:
drivers/scsi/aacraid/aachba.c:943:3: warning: Value stored to 'c' is
never read

Fixes: f4e8708d3104 ("scsi: aacraid: Fix udev inquiry race condition")
Signed-off-by: Colin Ian King 
---
 drivers/scsi/aacraid/aachba.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index a2bdd7931cf1..525d72fcbf3e 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -940,11 +940,8 @@ static void setinqstr(struct aac_dev *dev, void *data, int 
tindex)
while (*cp == ' ')
++cp;
/* last six chars reserved for vol type */
-   c = 0;
-   if (strlen(cp) > sizeof(str->pid)) {
-   c = cp[sizeof(str->pid)];
+   if (strlen(cp) > sizeof(str->pid))
cp[sizeof(str->pid)] = '\0';
-   }
inqstrcpy (cp, str->pid);
 
kfree(cname);
-- 
2.15.1



[PATCH] scsi: lpfc: fix a couple of minor indentation issues

2017-12-21 Thread Colin King
From: Colin Ian King 

Several statements are indented too far, fix these

Signed-off-by: Colin Ian King 
---
 drivers/scsi/lpfc/lpfc_els.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index dfb21d9efb0d..234c7c015982 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -6862,7 +6862,7 @@ lpfc_els_rcv_rtv(struct lpfc_vport *vport, struct 
lpfc_iocbq *cmdiocb,
return 1;
 
pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt);
-   *((uint32_t *) (pcmd)) = ELS_CMD_ACC;
+   *((uint32_t *) (pcmd)) = ELS_CMD_ACC;
pcmd += sizeof(uint32_t); /* Skip past command */
 
/* use the command's xri in the response */
@@ -8155,9 +8155,9 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct 
lpfc_sli_ring *pring,
lpfc_nlp_put(ndlp);
break;
case ELS_CMD_REC:
-   /* receive this due to exchange closed */
-   rjt_err = LSRJT_UNABLE_TPC;
-   rjt_exp = LSEXP_INVALID_OX_RX;
+   /* receive this due to exchange closed */
+   rjt_err = LSRJT_UNABLE_TPC;
+   rjt_exp = LSEXP_INVALID_OX_RX;
break;
default:
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
-- 
2.14.1



[PATCH] scsi: lpfc: don't dereference localport before it has been null checked

2017-12-21 Thread Colin King
From: Colin Ian King 

localport is being dereferenced to assign lport and then immediately
afterwards localport is being sanity checked to see if it is null.
Fix this by only dereferencing localport until after it has been
null checked.

Detected by CoverityScan, CID#1463038 ("Dereference before null check")

Fixes: 3a8cefbfc5ee ("scsi: lpfc: Beef up stat counters for debug")
Signed-off-by: Colin Ian King 
---
 drivers/scsi/lpfc/lpfc_attr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 797bb42a6306..986a3dc2efaf 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -277,13 +277,13 @@ lpfc_nvme_info_show(struct device *dev, struct 
device_attribute *attr,
}
 
localport = vport->localport;
-   lport = (struct lpfc_nvme_lport *)localport->private;
if (!localport) {
len = snprintf(buf, PAGE_SIZE,
"NVME Initiator x%llx is not allocated\n",
wwn_to_u64(vport->fc_portname.u.wwn));
return len;
}
+   lport = (struct lpfc_nvme_lport *)localport->private;
len = snprintf(buf, PAGE_SIZE, "NVME Initiator Enabled\n");
 
spin_lock_irq(shost->host_lock);
-- 
2.14.1



[PATCH][next] scsi: arcmsr: remove redundant check for secs < 0

2017-12-08 Thread Colin King
From: Colin Ian King 

The check for secs being less than zero is redundant for two reasons.
Firstly, secs is unsigned so the check is always going to be false.
Secondly, if secs was signed the proceeding calculation of secs is
never going to be negative.  Hence we can remove this redundant check
and day and secs re-adjustment.

Detected by static analysis with smatch:
arcmsr_set_iop_datetime() warn: unsigned 'secs' is never less than zero.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/arcmsr/arcmsr_hba.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 0707a60bf5c0..e4258b69f4be 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -3679,10 +3679,6 @@ static void arcmsr_set_iop_datetime(struct timer_list *t)
secs = (u32)(tv.tv_sec - (sys_tz.tz_minuteswest * 60));
days = secs / 86400;
secs = secs - 86400 * days;
-   if (secs < 0) {
-   days = days - 1;
-   secs = secs + 86400;
-   }
j = days / 146097;
i = days - 146097 * j;
a = i + 719468;
-- 
2.14.1



[PATCH] scsi: fusion: clean up some indentations

2017-12-06 Thread Colin King
From: Colin Ian King 

There are several places where the source is not indented correctly
with either too many or too few levels of intentation. Fix these.

Signed-off-by: Colin Ian King 
---
 drivers/message/fusion/mptbase.c | 57 
 1 file changed, 29 insertions(+), 28 deletions(-)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 7a93400eea2a..8df37fa1e977 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -958,7 +958,7 @@ mpt_put_msg_frame(u8 cb_idx, MPT_ADAPTER *ioc, 
MPT_FRAME_HDR *mf)
 {
u32 mf_dma_addr;
int req_offset;
-   u16  req_idx;   /* Request index */
+   u16 req_idx;/* Request index */
 
/* ensure values are reset properly! */
mf->u.frame.hwhdr.msgctxu.fld.cb_idx = cb_idx;  /* byte */
@@ -994,7 +994,7 @@ mpt_put_msg_frame_hi_pri(u8 cb_idx, MPT_ADAPTER *ioc, 
MPT_FRAME_HDR *mf)
 {
u32 mf_dma_addr;
int req_offset;
-   u16  req_idx;   /* Request index */
+   u16 req_idx;/* Request index */
 
/* ensure values are reset properly! */
mf->u.frame.hwhdr.msgctxu.fld.cb_idx = cb_idx;
@@ -1128,11 +1128,12 @@ mpt_add_sge_64bit_1078(void *pAddr, u32 flagslength, 
dma_addr_t dma_addr)
 static void
 mpt_add_chain(void *pAddr, u8 next, u16 length, dma_addr_t dma_addr)
 {
-   SGEChain32_t *pChain = (SGEChain32_t *) pAddr;
-   pChain->Length = cpu_to_le16(length);
-   pChain->Flags = MPI_SGE_FLAGS_CHAIN_ELEMENT;
-   pChain->NextChainOffset = next;
-   pChain->Address = cpu_to_le32(dma_addr);
+   SGEChain32_t *pChain = (SGEChain32_t *) pAddr;
+
+   pChain->Length = cpu_to_le16(length);
+   pChain->Flags = MPI_SGE_FLAGS_CHAIN_ELEMENT;
+   pChain->NextChainOffset = next;
+   pChain->Address = cpu_to_le32(dma_addr);
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -1147,18 +1148,18 @@ mpt_add_chain(void *pAddr, u8 next, u16 length, 
dma_addr_t dma_addr)
 static void
 mpt_add_chain_64bit(void *pAddr, u8 next, u16 length, dma_addr_t dma_addr)
 {
-   SGEChain64_t *pChain = (SGEChain64_t *) pAddr;
-   u32 tmp = dma_addr & 0x;
+   SGEChain64_t *pChain = (SGEChain64_t *) pAddr;
+   u32 tmp = dma_addr & 0x;
 
-   pChain->Length = cpu_to_le16(length);
-   pChain->Flags = (MPI_SGE_FLAGS_CHAIN_ELEMENT |
-MPI_SGE_FLAGS_64_BIT_ADDRESSING);
+   pChain->Length = cpu_to_le16(length);
+   pChain->Flags = (MPI_SGE_FLAGS_CHAIN_ELEMENT |
+MPI_SGE_FLAGS_64_BIT_ADDRESSING);
 
-   pChain->NextChainOffset = next;
+   pChain->NextChainOffset = next;
 
-   pChain->Address.Low = cpu_to_le32(tmp);
-   tmp = (u32)(upper_32_bits(dma_addr));
-   pChain->Address.High = cpu_to_le32(tmp);
+   pChain->Address.Low = cpu_to_le32(tmp);
+   tmp = (u32)(upper_32_bits(dma_addr));
+   pChain->Address.High = cpu_to_le32(tmp);
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -1360,7 +1361,7 @@ mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init)
ioc->add_sge(psge, flags_length, ioc->HostPageBuffer_dma);
ioc->facts.HostPageBufferSGE = ioc_init->HostPageBufferSGE;
 
-return 0;
+   return 0;
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -2152,7 +2153,7 @@ mpt_suspend(struct pci_dev *pdev, pm_message_t state)
device_state);
 
/* put ioc into READY_STATE */
-   if(SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP)) {
+   if (SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP)) {
printk(MYIOC_s_ERR_FMT
"pci-suspend:  IOC msg unit reset failed!\n", ioc->name);
}
@@ -6348,7 +6349,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
u8   page_type = 0, extend_page;
unsigned longtimeleft;
unsigned longflags;
-int in_isr;
+   int  in_isr;
u8   issue_hard_reset = 0;
u8   retry_count = 0;
 
@@ -8092,15 +8093,15 @@ mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info)
 static void
 mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info, u8 cb_idx)
 {
-union loginfo_type {
-   u32 loginfo;
-   struct {
-   u32 subcode:16;
-   u32 code:8;
-   u32 originator:4;
-   u32 bus_type:4;
-   }dw;
-};
+   union loginfo_type {
+   u32 loginfo;
+   struct {
+   u32 subcode:16;
+   u32 code:8;
+   u32 

[PATCH] scsi: ipr: fix incorrect indentation of assignment statement

2017-12-01 Thread Colin King
From: Colin Ian King 

Remove one extraneous level of indentation on an assignment statement.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/ipr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index cc0187965eee..e07dd990e585 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -9653,8 +9653,8 @@ static int ipr_alloc_cmd_blks(struct ipr_ioa_cfg *ioa_cfg)
if (i == 0) {
entries_each_hrrq = IPR_NUM_INTERNAL_CMD_BLKS;
ioa_cfg->hrrq[i].min_cmd_id = 0;
-   ioa_cfg->hrrq[i].max_cmd_id =
-   (entries_each_hrrq - 1);
+   ioa_cfg->hrrq[i].max_cmd_id =
+   (entries_each_hrrq - 1);
} else {
entries_each_hrrq =
IPR_NUM_BASE_CMD_BLKS/
-- 
2.14.1



[PATCH] scsi: csiostor: fix spelling mistake: "Couldnt" -> "Couldn't"

2017-12-01 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in error message text.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/csiostor/csio_mb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/csiostor/csio_mb.c b/drivers/scsi/csiostor/csio_mb.c
index 931b1d8f9f3e..5f4e0a787bd1 100644
--- a/drivers/scsi/csiostor/csio_mb.c
+++ b/drivers/scsi/csiostor/csio_mb.c
@@ -1216,7 +1216,7 @@ csio_mb_issue(struct csio_hw *hw, struct csio_mb *mbp)
/* Queue mbox cmd, if another mbox cmd is active */
if (mbp->mb_cbfn == NULL) {
rv = -EBUSY;
-   csio_dbg(hw, "Couldnt own Mailbox %x op:0x%x\n",
+   csio_dbg(hw, "Couldn't own Mailbox %x op:0x%x\n",
hw->pfn, *((uint8_t *)mbp->mb));
 
goto error_out;
@@ -1244,14 +1244,14 @@ csio_mb_issue(struct csio_hw *hw, struct csio_mb *mbp)
rv = owner ? -EBUSY : -ETIMEDOUT;
 
csio_dbg(hw,
-"Couldnt own Mailbox %x op:0x%x "
+"Couldn't own Mailbox %x op:0x%x "
 "owner:%x\n",
 hw->pfn, *((uint8_t *)mbp->mb), owner);
goto error_out;
} else {
if (mbm->mcurrent == NULL) {
csio_err(hw,
-"Couldnt own Mailbox %x "
+"Couldn't own Mailbox %x "
 "op:0x%x owner:%x\n",
 hw->pfn, *((uint8_t *)mbp->mb),
 owner);
-- 
2.14.1



[PATCH] scsi: bnx2fc: fix spelling mistake: "Couldnt" -> "Couldn't"

2017-12-01 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in error message text.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index e6b9de7d41ac..65de1d0578a1 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -1552,7 +1552,7 @@ static struct fc_lport *bnx2fc_if_create(struct 
bnx2fc_interface *interface,
 
rc = bnx2fc_shost_config(lport, parent);
if (rc) {
-   printk(KERN_ERR PFX "Couldnt configure shost for %s\n",
+   printk(KERN_ERR PFX "Couldn't configure shost for %s\n",
interface->netdev->name);
goto lp_config_err;
}
@@ -1560,7 +1560,7 @@ static struct fc_lport *bnx2fc_if_create(struct 
bnx2fc_interface *interface,
/* Initialize the libfc library */
rc = bnx2fc_libfc_config(lport);
if (rc) {
-   printk(KERN_ERR PFX "Couldnt configure libfc\n");
+   printk(KERN_ERR PFX "Couldn't configure libfc\n");
goto shost_err;
}
fc_host_port_type(lport->host) = FC_PORTTYPE_UNKNOWN;
-- 
2.14.1



[PATCH] scsi: wd719x: make card_types static const, shrinks object size

2017-11-28 Thread Colin King
From: Colin Ian King 

Don't populate the read-only array card_types on the stack but instead
make it static and constify it. Makes the object code smaller by over
110 bytes:

Before:
   textdata bss dec hex filename
  256255752   0   313777a91 drivers/scsi/wd719x.o

After:
   textdata bss dec hex filename
  254475816   0   312637a1f drivers/scsi/wd719x.o

(gcc version 7.2.0 x86_64)

Signed-off-by: Colin Ian King 
---
 drivers/scsi/wd719x.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
index 2a9da2e0ea6b..2ba2b7b47f41 100644
--- a/drivers/scsi/wd719x.c
+++ b/drivers/scsi/wd719x.c
@@ -803,7 +803,9 @@ static enum wd719x_card_type wd719x_detect_type(struct 
wd719x *wd)
 static int wd719x_board_found(struct Scsi_Host *sh)
 {
struct wd719x *wd = shost_priv(sh);
-   char *card_types[] = { "Unknown card", "WD7193", "WD7197", "WD7296" };
+   static const char * const card_types[] = {
+   "Unknown card", "WD7193", "WD7197", "WD7296"
+   };
int ret;
 
INIT_LIST_HEAD(>active_scbs);
-- 
2.14.1



[PATCH] scsi: sym53c8xx_2: use setup_timer instead of init_timer

2017-11-24 Thread Colin King
From: Colin Ian King 

Use setup_timer function instead of initializing timer with the
function and data fields.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/sym53c8xx_2/sym_glue.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index d32e3ba8863e..285397d42558 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1351,9 +1351,7 @@ static struct Scsi_Host *sym_attach(struct 
scsi_host_template *tpnt, int unit,
/*
 *  Start the timer daemon
 */
-   init_timer(>s.timer);
-   np->s.timer.data = (unsigned long) np;
-   np->s.timer.function = sym53c8xx_timer;
+   setup_timer(>s.timer, sym53c8xx_timer, (unsigned long)np);
np->s.lasttime=0;
sym_timer (np);
 
-- 
2.14.1



[PATCH] scsi: bfa: use setup_timer instead of init_timer

2017-11-24 Thread Colin King
From: Colin Ian King 

Use setup_timer function instead of initializing timer with the
function and data fields.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/bfa/bfad.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index 5caf5f3ff642..c910b238bc9e 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -719,10 +719,7 @@ bfad_bfa_tmo(unsigned long data)
 void
 bfad_init_timer(struct bfad_s *bfad)
 {
-   init_timer(>hal_tmo);
-   bfad->hal_tmo.function = bfad_bfa_tmo;
-   bfad->hal_tmo.data = (unsigned long)bfad;
-
+   setup_timer(>hal_tmo, bfad_bfa_tmo, (unsigned long)bfad);
mod_timer(>hal_tmo,
  jiffies + msecs_to_jiffies(BFA_TIMER_FREQ));
 }
-- 
2.14.1



[PATCH] bfa: remove unused pointer 'port'

2017-11-15 Thread Colin King
From: Colin Ian King 

The pointer 'port' is being assigned but it is never read,
hence it is redundant and can be removed. Cleans up clang warning:

drivers/scsi/bfa/bfad_attr.c:505:2: warning: Value stored to 'port'
is never read

Signed-off-by: Colin Ian King 
---
 drivers/scsi/bfa/bfad_attr.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c
index 13db3b7bc873..78b9aaadeeaa 100644
--- a/drivers/scsi/bfa/bfad_attr.c
+++ b/drivers/scsi/bfa/bfad_attr.c
@@ -487,7 +487,6 @@ bfad_im_vport_delete(struct fc_vport *fc_vport)
struct bfad_im_port_s *im_port =
(struct bfad_im_port_s *) vport->drv_port.im_port;
struct bfad_s *bfad = im_port->bfad;
-   struct bfad_port_s *port;
struct bfa_fcs_vport_s *fcs_vport;
struct Scsi_Host *vshost;
wwn_t   pwwn;
@@ -502,8 +501,6 @@ bfad_im_vport_delete(struct fc_vport *fc_vport)
return 0;
}
 
-   port = im_port->port;
-
vshost = vport->drv_port.im_port->shost;
u64_to_wwn(fc_host_port_name(vshost), (u8 *));
 
-- 
2.14.1



[PATCH] scsi: aacraid: remove unused variable managed_request_id

2017-11-15 Thread Colin King
From: Colin Ian King 

Variable managed_request_id is being assigned but it is never read,
hence it is redundant and can be removed. Cleans up clang warning:

drivers/scsi/aacraid/linit.c:706:5: warning: Value stored to
'managed_request_id' is never read

Signed-off-by: Colin Ian King 
---
 drivers/scsi/aacraid/linit.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index c9252b138c1f..3677beff9c17 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -690,7 +690,6 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)
struct aac_hba_tm_req *tmf;
int status;
u64 address;
-   __le32 managed_request_id;
 
pr_err("%s: Host adapter abort request (%d,%d,%d,%d)\n",
 AAC_DRIVERNAME,
@@ -703,8 +702,6 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)
(fib->flags & FIB_CONTEXT_FLAG_NATIVE_HBA) &&
(fib->callback_data == cmd)) {
found = 1;
-   managed_request_id = ((struct aac_hba_cmd_req *)
-   fib->hw_fib_va)->request_id;
break;
}
}
-- 
2.14.1



[PATCH] scsi: megaraid_sas: fix spelling mistake: "thershold" -> "threshold"

2017-11-02 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in dev_info message

Signed-off-by: Colin Ian King 
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index ad162fed389c..569663bab771 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -283,7 +283,7 @@ megasas_fusion_update_can_queue(struct megasas_instance 
*instance, int fw_boot_c
(instance->instancet->read_fw_status_reg(reg_set) & 
0x00) - MEGASAS_FUSION_IOCTL_CMDS;
 
dev_info(>pdev->dev,
-"Current firmware supports maximum commands: %d\t LDIO 
thershold: %d\n",
+"Current firmware supports maximum commands: %d\t LDIO 
threshold: %d\n",
 cur_max_fw_cmds, ldio_threshold);
 
if (fw_boot_context == OCR_CONTEXT) {
-- 
2.14.1



[PATCH] scsi: aic7xxx: make a couple of functions static

2017-10-05 Thread Colin King
From: Colin Ian King 

Functions ahc_devlimited_syncrate and ahc_linux_initialize_scsi_bus
are declared static in their prototypes but are missing in their
definitions, so add the missing static.

Cleans up sparse warnings:
symbol 'ahc_devlimited_syncrate' was not declared. Should it be static?
symbol 'ahc_linux_initialize_scsi_bus' was not declared. Should it
be static?

Signed-off-by: Colin Ian King 
---
 drivers/scsi/aic7xxx/aic7xxx_core.c | 2 +-
 drivers/scsi/aic7xxx/aic7xxx_osm.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c 
b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 381846164003..6612ff3b2e83 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -2212,7 +2212,7 @@ ahc_free_tstate(struct ahc_softc *ahc, u_int scsi_id, 
char channel, int force)
  * by the capabilities of the bus connectivity of and sync settings for
  * the target.
  */
-const struct ahc_syncrate *
+static const struct ahc_syncrate *
 ahc_devlimited_syncrate(struct ahc_softc *ahc,
struct ahc_initiator_tinfo *tinfo,
u_int *period, u_int *ppr_options, role_t role)
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c 
b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index acd687f4554e..c6be3aeb302b 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1141,7 +1141,7 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct 
scsi_host_template *templa
  * or forcing transfer negotiations on the next command to any
  * target.
  */
-void
+static void
 ahc_linux_initialize_scsi_bus(struct ahc_softc *ahc)
 {
int i;
-- 
2.14.1



[PATCH] scsi: libsas: remove unused variable sas_ha

2017-09-26 Thread Colin King
From: Colin Ian King 

Remove unused variable sas_ha to clean up build warning
"unused variable ‘sas_ha’ [-Wunused-variable]"

Fixes: 042ebd293b86 ("scsi: libsas: kill useless ha_event and do some cleanup")
Signed-off-by: Colin Ian King 
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c 
b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 29d6cb39299c..9e2990268f00 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -1046,7 +1046,6 @@ static void hisi_sas_rescan_topology(struct hisi_hba 
*hisi_hba, u32 old_state,
 
 static int hisi_sas_controller_reset(struct hisi_hba *hisi_hba)
 {
-   struct sas_ha_struct *sas_ha = _hba->sha;
struct device *dev = hisi_hba->dev;
struct Scsi_Host *shost = hisi_hba->shost;
u32 old_state, state;
-- 
2.14.1



[PATCH] scsi: libfc: fix potential null lport dereference

2017-09-20 Thread Colin King
From: Colin Ian King 

Don't pass a null lport to FC_LPORT_DBG as this causes a null pointer
dereference when accessing lport->host and lport->port_id. Instead
use the FC_CHECK_LOGGING macro to print the kernel message via pr_info.

Detected by CoverityScan, CID#113198 ("Dereference after null check")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/libfc/fc_exch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 42bcf7f3a0f9..46d842d238f1 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -2603,8 +2603,8 @@ void fc_exch_recv(struct fc_lport *lport, struct fc_frame 
*fp)
 
/* lport lock ? */
if (!lport || lport->state == LPORT_ST_DISABLED) {
-   FC_LPORT_DBG(lport, "Receiving frames for an lport that "
-"has not been initialized correctly\n");
+   FC_CHECK_LOGGING(FC_LPORT_LOGGING,
+pr_info("Receiving frames for an lport that 
has not been initialized correctly\n"));
fc_frame_free(fp);
return;
}
-- 
2.14.1



[PATCH] ufs: make const array setup_attrs static to shink object code size

2017-09-16 Thread Colin King
From: Colin Ian King 

Don't populate const array setup_attrs on the stack, instead make it
static.  Makes the object code smaller by over 120 bytes:

Before:
   textdata bss dec hex filename
   1588 208   01796 704 drivers/scsi/ufs/ufshcd-dwc.o

After:
   textdata bss dec hex filename
   1371 304   01675 68b drivers/scsi/ufs/ufshcd-dwc.o

Signed-off-by: Colin Ian King 
---
 drivers/scsi/ufs/ufshcd-dwc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufshcd-dwc.c b/drivers/scsi/ufs/ufshcd-dwc.c
index 5fd16c72207f..f061609c424d 100644
--- a/drivers/scsi/ufs/ufshcd-dwc.c
+++ b/drivers/scsi/ufs/ufshcd-dwc.c
@@ -83,7 +83,7 @@ static int ufshcd_dwc_link_is_up(struct ufs_hba *hba)
  */
 static int ufshcd_dwc_connection_setup(struct ufs_hba *hba)
 {
-   const struct ufshcd_dme_attr_val setup_attrs[] = {
+   static const struct ufshcd_dme_attr_val setup_attrs[] = {
{ UIC_ARG_MIB(T_CONNECTIONSTATE), 0, DME_LOCAL },
{ UIC_ARG_MIB(N_DEVICEID), 0, DME_LOCAL },
{ UIC_ARG_MIB(N_DEVICEID_VALID), 0, DME_LOCAL },
-- 
2.14.1



[PATCH] scsi: scsi_transport_spi: make const arrays static to shink object code size

2017-09-16 Thread Colin King
From: Colin Ian King 

Don't populate const arrays on the stack, instead make them static.
Makes the object code smaller by over 530 bytes:

Before:
  37010   14144 128   51282c852 drivers/scsi/scsi_transport_spi.o

After:
   textdata bss dec hex filename
  36312   14304 128   50744c638 drivers/scsi/scsi_transport_spi.o

Signed-off-by: Colin Ian King 
---
 drivers/scsi/scsi_transport_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_transport_spi.c 
b/drivers/scsi/scsi_transport_spi.c
index d0219e36080c..3f7ad400fb8d 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -819,11 +819,11 @@ spi_dv_device_get_echo_buffer(struct scsi_device *sdev, 
u8 *buffer)
 * fails, the device won't let us write to the echo buffer
 * so just return failure */

-   const char spi_test_unit_ready[] = {
+   static const char spi_test_unit_ready[] = {
TEST_UNIT_READY, 0, 0, 0, 0, 0
};
 
-   const char spi_read_buffer_descriptor[] = {
+   static const char spi_read_buffer_descriptor[] = {
READ_BUFFER, 0x0b, 0, 0, 0, 0, 0, 0, 4, 0
};
 
-- 
2.14.1



[PATCH] scsi: ufs: tc-dwc-g210: make arrays static, reduces object code size

2017-09-12 Thread Colin King
From: Colin Ian King 

Don't populate const arrays on the stack, instead make them
static.  Makes the object code smaller by over 740 bytes.

Before:
   textdata bss dec hex filename
   3840 208   04048 fd0 drivers/scsi/ufs/tc-dwc-g210.o

After:
   textdata bss dec hex filename
   2679 624   03303 ce7 drivers/scsi/ufs/tc-dwc-g210.o

Signed-off-by: Colin Ian King 
---
 drivers/scsi/ufs/tc-dwc-g210.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/ufs/tc-dwc-g210.c b/drivers/scsi/ufs/tc-dwc-g210.c
index dc03e47f7c58..3a8bc6d9cb5b 100644
--- a/drivers/scsi/ufs/tc-dwc-g210.c
+++ b/drivers/scsi/ufs/tc-dwc-g210.c
@@ -26,7 +26,7 @@
  */
 static int tc_dwc_g210_setup_40bit_rmmi(struct ufs_hba *hba)
 {
-   const struct ufshcd_dme_attr_val setup_attrs[] = {
+   static const struct ufshcd_dme_attr_val setup_attrs[] = {
{ UIC_ARG_MIB(TX_GLOBALHIBERNATE), 0x00, DME_LOCAL },
{ UIC_ARG_MIB(REFCLKMODE), 0x01, DME_LOCAL },
{ UIC_ARG_MIB(CDIRECTCTRL6), 0x80, DME_LOCAL },
@@ -90,7 +90,7 @@ static int tc_dwc_g210_setup_40bit_rmmi(struct ufs_hba *hba)
  */
 static int tc_dwc_g210_setup_20bit_rmmi_lane0(struct ufs_hba *hba)
 {
-   const struct ufshcd_dme_attr_val setup_attrs[] = {
+   static const struct ufshcd_dme_attr_val setup_attrs[] = {
{ UIC_ARG_MIB_SEL(TX_REFCLKFREQ, SELIND_LN0_TX), 0x01,
DME_LOCAL },
{ UIC_ARG_MIB_SEL(TX_CFGCLKFREQVAL, SELIND_LN0_TX), 0x19,
@@ -147,7 +147,7 @@ static int tc_dwc_g210_setup_20bit_rmmi_lane1(struct 
ufs_hba *hba)
int connected_tx_lanes = 0;
int ret = 0;
 
-   const struct ufshcd_dme_attr_val setup_tx_attrs[] = {
+   static const struct ufshcd_dme_attr_val setup_tx_attrs[] = {
{ UIC_ARG_MIB_SEL(TX_REFCLKFREQ, SELIND_LN1_TX), 0x0d,
DME_LOCAL },
{ UIC_ARG_MIB_SEL(TX_CFGCLKFREQVAL, SELIND_LN1_TX), 0x19,
@@ -158,7 +158,7 @@ static int tc_dwc_g210_setup_20bit_rmmi_lane1(struct 
ufs_hba *hba)
DME_LOCAL },
};
 
-   const struct ufshcd_dme_attr_val setup_rx_attrs[] = {
+   static const struct ufshcd_dme_attr_val setup_rx_attrs[] = {
{ UIC_ARG_MIB_SEL(RX_REFCLKFREQ, SELIND_LN1_RX), 0x01,
DME_LOCAL },
{ UIC_ARG_MIB_SEL(RX_CFGCLKFREQVAL, SELIND_LN1_RX), 0x19,
@@ -222,7 +222,7 @@ static int tc_dwc_g210_setup_20bit_rmmi(struct ufs_hba *hba)
 {
int ret = 0;
 
-   const struct ufshcd_dme_attr_val setup_attrs[] = {
+   static const struct ufshcd_dme_attr_val setup_attrs[] = {
{ UIC_ARG_MIB(TX_GLOBALHIBERNATE), 0x00, DME_LOCAL },
{ UIC_ARG_MIB(REFCLKMODE), 0x01, DME_LOCAL },
{ UIC_ARG_MIB(CDIRECTCTRL6), 0xc0, DME_LOCAL },
-- 
2.14.1



[PATCH] scsi: lpfc: remove redundant null check on eqe

2017-09-08 Thread Colin King
From: Colin Ian King 

The pointer eqe is always non-null inside the while loop, so the
check to see if eqe is NULL is redudant and hence can be removed.

Detected by CoverityScan CID#1248693 ("Logically Dead Code")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/lpfc/lpfc_sli.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 8b119f87b51d..80036a9fae7f 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -13760,9 +13760,6 @@ lpfc_sli4_hba_intr_handler(int irq, void *dev_id)
 * Process all the event on FCP fast-path EQ
 */
while ((eqe = lpfc_sli4_eq_get(fpeq))) {
-   if (eqe == NULL)
-   break;
-
ccount += lpfc_sli4_hba_handle_eqe(phba, eqe, hba_eqidx);
if (!(++ecount % fpeq->entry_repost) ||
ccount > LPFC_MAX_ISR_CQE)
-- 
2.14.1



[PATCH] csi: libcxgbi: remove redundant check and close on csk

2017-09-07 Thread Colin King
From: Colin Ian King 

csk is always null on the error return path and so the non-null
check and call to cxgbi_sock_closed on csk is redundant and
can be removed.

Detected by: CoverityScan CID#114329 ("Logically dead code")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/cxgbi/libcxgbi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index 512c8f1ea5b0..da36c2de069e 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -688,8 +688,6 @@ cxgbi_check_route(struct sockaddr *dst_addr, int ifindex)
 
 rel_rt:
ip_rt_put(rt);
-   if (csk)
-   cxgbi_sock_closed(csk);
 err_out:
return ERR_PTR(err);
 }
-- 
2.14.1



[PATCH] scsi: qla2xxx: fix spelling mistake of variable sfp_additonal_info

2017-08-16 Thread Colin King
From: Colin Ian King 

Trivial fix to variable name, sfp_additonal_info should be
sfp_additional_info (add in missing i).

Signed-off-by: Colin Ian King 
---
 drivers/scsi/qla2xxx/qla_isr.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index c14fab35fc36..916f685872aa 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -452,7 +452,7 @@ qla83xx_handle_8200_aen(scsi_qla_host_t *vha, uint16_t *mb)
uint16_t peg_fw_state, nw_interface_link_up;
uint16_t nw_interface_signal_detect, sfp_status;
uint16_t htbt_counter, htbt_monitor_enable;
-   uint16_t sfp_additonal_info, sfp_multirate;
+   uint16_t sfp_additional_info, sfp_multirate;
uint16_t sfp_tx_fault, link_speed, dcbx_status;
 
/*
@@ -492,7 +492,7 @@ qla83xx_handle_8200_aen(scsi_qla_host_t *vha, uint16_t *mb)
sfp_status = ((mb[2] & 0x0c00) >> 10);
htbt_counter = ((mb[2] & 0x7000) >> 12);
htbt_monitor_enable = ((mb[2] & 0x8000) >> 15);
-   sfp_additonal_info = (mb[6] & 0x0003);
+   sfp_additional_info = (mb[6] & 0x0003);
sfp_multirate = ((mb[6] & 0x0004) >> 2);
sfp_tx_fault = ((mb[6] & 0x0008) >> 3);
link_speed = ((mb[6] & 0x0070) >> 4);
@@ -507,9 +507,9 @@ qla83xx_handle_8200_aen(scsi_qla_host_t *vha, uint16_t *mb)
sfp_status);
ql_log(ql_log_warn, vha, 0x5067,
"htbt_counter=0x%x, htbt_monitor_enable=0x%x, "
-   "sfp_additonal_info=0x%x, sfp_multirate=0x%x.\n ",
+   "sfp_additional_info=0x%x, sfp_multirate=0x%x.\n ",
htbt_counter, htbt_monitor_enable,
-   sfp_additonal_info, sfp_multirate);
+   sfp_additional_info, sfp_multirate);
ql_log(ql_log_warn, vha, 0x5068,
"sfp_tx_fault=0x%x, link_state=0x%x, "
"dcbx_status=0x%x.\n", sfp_tx_fault, link_speed,
-- 
2.11.0



[PATCH] scsi: add missing indent on a for loop statement

2017-08-15 Thread Colin King
From: Colin Ian King 

The for loop is statement is missing an indent, add it.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/osst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 97ab5f160bc6..241908aca468 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -5434,7 +5434,7 @@ static int append_to_buffer(const char __user *ubp, 
struct osst_buffer *st_bp, i
 
for (i=0, offset=st_bp->buffer_bytes;
 i < st_bp->sg_segs && offset >= st_bp->sg[i].length; i++)
-   offset -= st_bp->sg[i].length;
+   offset -= st_bp->sg[i].length;
if (i == st_bp->sg_segs) {  /* Should never happen */
printk(KERN_WARNING "osst :A: Append_to_buffer offset 
overflow.\n");
return (-EIO);
-- 
2.11.0



[PATCH] scsi: mpt3sas: fix pr_info message continuation

2017-08-15 Thread Colin King
From: Colin Ian King 

An optional discovery status should be printed with a pr_cont
and needs a leading space to make it more readable. The final
new line should also be a pr_cont and the indentation is out
by one, so fix that too.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 8a44636ab0b5..8705bca3 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -615,9 +615,9 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc,
(event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED) ?
"start" : "stop");
if (event_data->DiscoveryStatus)
-   pr_info("discovery_status(0x%08x)",
+   pr_cont(" discovery_status(0x%08x)",
le32_to_cpu(event_data->DiscoveryStatus));
-   pr_info("\n");
+   pr_cont("\n");
return;
}
case MPI2_EVENT_SAS_BROADCAST_PRIMITIVE:
-- 
2.11.0



[PATCH] scsi: dpt_i2o: remove redundant null check on array device

2017-08-09 Thread Colin King
From: Colin Ian King 

The null check on pHba->channel[chan].device is redundant because
device is an array and hence can never be null. Remove the check.

Detected by CoverityScan, CID#115362 ("Array compared against 0")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/dpt_i2o.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 256dd6791fcc..fd172b0890d3 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -1169,11 +1169,6 @@ static struct adpt_device* adpt_find_device(adpt_hba* 
pHba, u32 chan, u32 id, u6
if(chan < 0 || chan >= MAX_CHANNEL)
return NULL;

-   if( pHba->channel[chan].device == NULL){
-   printk(KERN_DEBUG"Adaptec I2O RAID: Trying to find device 
before they are allocated\n");
-   return NULL;
-   }
-
d = pHba->channel[chan].device[id];
if(!d || d->tid == 0) {
return NULL;
-- 
2.11.0



[PATCH] scsi: hisi_sas: make several const arrays static

2017-07-11 Thread Colin King
From: Colin Ian King 

Don't populate various tables on the stack but make them static const.
Makes the object code smaller by over 280 bytes:

Before:
   textdata bss dec hex filename
  398875080  64   45031afe7 hisi_sas_v2_hw.o

After:
   textdata bss dec hex filename
  393185368  64   44750aece hisi_sas_v2_hw.o

Signed-off-by: Colin Ian King 
---
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c 
b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index 551d103c27f1..2bfea7082e3a 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -1693,7 +1693,7 @@ static int prep_ssp_v2_hw(struct hisi_hba *hisi_hba,
 
 static int parse_trans_tx_err_code_v2_hw(u32 err_msk)
 {
-   const u8 trans_tx_err_code_prio[] = {
+   static const u8 trans_tx_err_code_prio[] = {
TRANS_TX_OPEN_FAIL_WITH_IT_NEXUS_LOSS,
TRANS_TX_ERR_PHY_NOT_ENABLE,
TRANS_TX_OPEN_CNX_ERR_WRONG_DESTINATION,
@@ -1738,7 +1738,7 @@ static int parse_trans_tx_err_code_v2_hw(u32 err_msk)
 
 static int parse_trans_rx_err_code_v2_hw(u32 err_msk)
 {
-   const u8 trans_rx_err_code_prio[] = {
+   static const u8 trans_rx_err_code_prio[] = {
TRANS_RX_ERR_WITH_RXFRAME_CRC_ERR,
TRANS_RX_ERR_WITH_RXFIS_8B10B_DISP_ERR,
TRANS_RX_ERR_WITH_RXFRAME_HAVE_ERRPRM,
@@ -1784,7 +1784,7 @@ static int parse_trans_rx_err_code_v2_hw(u32 err_msk)
 
 static int parse_dma_tx_err_code_v2_hw(u32 err_msk)
 {
-   const u8 dma_tx_err_code_prio[] = {
+   static const u8 dma_tx_err_code_prio[] = {
DMA_TX_UNEXP_XFER_ERR,
DMA_TX_UNEXP_RETRANS_ERR,
DMA_TX_XFER_LEN_OVERFLOW,
@@ -1810,7 +1810,7 @@ static int parse_dma_tx_err_code_v2_hw(u32 err_msk)
 
 static int parse_sipc_rx_err_code_v2_hw(u32 err_msk)
 {
-   const u8 sipc_rx_err_code_prio[] = {
+   static const u8 sipc_rx_err_code_prio[] = {
SIPC_RX_FIS_STATUS_ERR_BIT_VLD,
SIPC_RX_PIO_WRSETUP_STATUS_DRQ_ERR,
SIPC_RX_FIS_STATUS_BSY_BIT_ERR,
@@ -1836,7 +1836,7 @@ static int parse_sipc_rx_err_code_v2_hw(u32 err_msk)
 
 static int parse_dma_rx_err_code_v2_hw(u32 err_msk)
 {
-   const u8 dma_rx_err_code_prio[] = {
+   static const u8 dma_rx_err_code_prio[] = {
DMA_RX_UNKNOWN_FRM_ERR,
DMA_RX_DATA_LEN_OVERFLOW,
DMA_RX_DATA_LEN_UNDERFLOW,
-- 
2.11.0



[PATCH] target: make device_mutex and device_list static

2017-07-04 Thread Colin King
From: Colin Ian King 

Variables device_mutex and device_list static are local to the source,
so make them static.

Cleans up sparse warnings:
"symbol 'device_list' was not declared. Should it be static?"
"symbol 'device_mutex' was not declared. Should it be static?"

Signed-off-by: Colin Ian King 
---
 drivers/target/target_core_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/target/target_core_device.c 
b/drivers/target/target_core_device.c
index 3ae8fbf01bdf..bbcef3bc66c8 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -49,8 +49,8 @@
 #include "target_core_pr.h"
 #include "target_core_ua.h"
 
-DEFINE_MUTEX(device_mutex);
-LIST_HEAD(device_list);
+static DEFINE_MUTEX(device_mutex);
+static LIST_HEAD(device_list);
 static DEFINE_IDR(devices_idr);
 
 static struct se_hba *lun0_hba;
-- 
2.11.0



[PATCH][V2] scsi: qedf: fix spelling mistake: "offlading" -> "offloading"

2017-07-03 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in QEDF_INFO message and 
remove duplicated "since" (thanks to Tyrel Datwyler for spotting
the latter issue).

Signed-off-by: Colin Ian King 
---
 drivers/scsi/qedf/qedf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index b58bba4604e8..7786c97e033f 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -1227,7 +1227,7 @@ static void qedf_rport_event_handler(struct fc_lport 
*lport,
 
if (rdata->spp_type != FC_TYPE_FCP) {
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
-   "Not offlading since since spp type isn't FCP\n");
+   "Not offloading since spp type isn't FCP\n");
break;
}
if (!(rdata->ids.roles & FC_RPORT_ROLE_FCP_TARGET)) {
-- 
2.11.0



[PATCH] scsi: qedi: fix another spelling mistake: "alloction" -> "allocation"

2017-07-03 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in QEDF_ERR message.  I should have
also included this in a previous fix, but I only just spotted this one.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/qedi/qedi_fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c
index 19254bd739d9..93d54acd4a22 100644
--- a/drivers/scsi/qedi/qedi_fw.c
+++ b/drivers/scsi/qedi/qedi_fw.c
@@ -1411,7 +1411,7 @@ static void qedi_tmf_work(struct work_struct *work)
 
list_work = kzalloc(sizeof(*list_work), GFP_ATOMIC);
if (!list_work) {
-   QEDI_ERR(>dbg_ctx, "Memory alloction failed\n");
+   QEDI_ERR(>dbg_ctx, "Memory allocation failed\n");
goto abort_ret;
}
 
-- 
2.11.0



[PATCH] scsi: isci: fix typo in function names

2017-07-03 Thread Colin King
From: Colin Ian King 

There are a couple of typos in function names and spelling of request
where the letters u and e are swapped:

scu_ssp_reqeust_construct_task_context
scu_sata_reqeust_construct_task_context

Fix the spelling of request.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/isci/request.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index 47f66e949745..ed197bc8e801 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -213,7 +213,7 @@ static void sci_task_request_build_ssp_task_iu(struct 
isci_request *ireq)
  * @task_context:
  *
  */
-static void scu_ssp_reqeust_construct_task_context(
+static void scu_ssp_request_construct_task_context(
struct isci_request *ireq,
struct scu_task_context *task_context)
 {
@@ -425,7 +425,7 @@ static void 
scu_ssp_io_request_construct_task_context(struct isci_request *ireq,
u8 prot_type = scsi_get_prot_type(scmd);
u8 prot_op = scsi_get_prot_op(scmd);
 
-   scu_ssp_reqeust_construct_task_context(ireq, task_context);
+   scu_ssp_request_construct_task_context(ireq, task_context);
 
task_context->ssp_command_iu_length =
sizeof(struct ssp_cmd_iu) / sizeof(u32);
@@ -472,7 +472,7 @@ static void 
scu_ssp_task_request_construct_task_context(struct isci_request *ire
 {
struct scu_task_context *task_context = ireq->tc;
 
-   scu_ssp_reqeust_construct_task_context(ireq, task_context);
+   scu_ssp_request_construct_task_context(ireq, task_context);
 
task_context->control_frame= 1;
task_context->priority = SCU_TASK_PRIORITY_HIGH;
@@ -495,7 +495,7 @@ static void 
scu_ssp_task_request_construct_task_context(struct isci_request *ire
  * the command buffer is complete. none Revisit task context construction to
  * determine what is common for SSP/SMP/STP task context structures.
  */
-static void scu_sata_reqeust_construct_task_context(
+static void scu_sata_request_construct_task_context(
struct isci_request *ireq,
struct scu_task_context *task_context)
 {
@@ -562,7 +562,7 @@ static void 
scu_stp_raw_request_construct_task_context(struct isci_request *ireq
 {
struct scu_task_context *task_context = ireq->tc;
 
-   scu_sata_reqeust_construct_task_context(ireq, task_context);
+   scu_sata_request_construct_task_context(ireq, task_context);
 
task_context->control_frame = 0;
task_context->priority  = SCU_TASK_PRIORITY_NORMAL;
@@ -613,7 +613,7 @@ static void sci_stp_optimized_request_construct(struct 
isci_request *ireq,
struct scu_task_context *task_context = ireq->tc;
 
/* Build the STP task context structure */
-   scu_sata_reqeust_construct_task_context(ireq, task_context);
+   scu_sata_request_construct_task_context(ireq, task_context);
 
/* Copy over the SGL elements */
sci_request_build_sgl(ireq);
@@ -1401,7 +1401,7 @@ static enum sci_status 
sci_stp_request_pio_data_out_transmit_data(struct isci_re
  * @data_buffer: The buffer of data to be copied.
  * @length: The length of the data transfer.
  *
- * Copy the data from the buffer for the length specified to the IO reqeust SGL
+ * Copy the data from the buffer for the length specified to the IO request SGL
  * specified data region. enum sci_status
  */
 static enum sci_status
-- 
2.11.0



[PATCH] scsi: qedf: fix spelling mistake: "offlading" -> "offloading"

2017-07-03 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in QEDF_INFO message

Signed-off-by: Colin Ian King 
---
 drivers/scsi/qedf/qedf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index b58bba4604e8..dc93e968a448 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -1227,7 +1227,7 @@ static void qedf_rport_event_handler(struct fc_lport 
*lport,
 
if (rdata->spp_type != FC_TYPE_FCP) {
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
-   "Not offlading since since spp type isn't FCP\n");
+   "Not offloading since since spp type isn't FCP\n");
break;
}
if (!(rdata->ids.roles & FC_RPORT_ROLE_FCP_TARGET)) {
-- 
2.11.0



[PATCH][V2] scsi: snic: fix a couple of spelling mistakes/typos

2017-06-30 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistakes/typos:

"requrest_irq" -> "request_irq"
"Firmwqre" -> "Firmware"

Signed-off-by: Colin Ian King 
---
 drivers/scsi/snic/snic_isr.c  | 4 ++--
 drivers/scsi/snic/snic_scsi.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/snic/snic_isr.c b/drivers/scsi/snic/snic_isr.c
index d859501e4ccd..c4da3673f2ae 100644
--- a/drivers/scsi/snic/snic_isr.c
+++ b/drivers/scsi/snic/snic_isr.c
@@ -141,7 +141,7 @@ snic_request_intr(struct snic *snic)
  snic->msix[i].devid);
if (ret) {
SNIC_HOST_ERR(snic->shost,
- "MSI-X: requrest_irq(%d) failed %d\n",
+ "MSI-X: request_irq(%d) failed %d\n",
  i,
  ret);
snic_free_intr(snic);
@@ -151,7 +151,7 @@ snic_request_intr(struct snic *snic)
}
 
return ret;
-} /* end of snic_requrest_intr */
+} /* end of snic_request_intr */
 
 int
 snic_set_intr_mode(struct snic *snic)
diff --git a/drivers/scsi/snic/snic_scsi.c b/drivers/scsi/snic/snic_scsi.c
index 05c3a7282d4a..d8a376b7882d 100644
--- a/drivers/scsi/snic/snic_scsi.c
+++ b/drivers/scsi/snic/snic_scsi.c
@@ -1260,7 +1260,7 @@ snic_io_cmpl_handler(struct vnic_dev *vdev,
default:
SNIC_BUG_ON(1);
SNIC_SCSI_DBG(snic->shost,
- "Unknown Firmwqre completion request type %d\n",
+ "Unknown Firmware completion request type %d\n",
  fwreq->hdr.type);
break;
}
-- 
2.11.0



[PATCH] scsi: snic: fix a couple of spelling mistakes/typos

2017-06-30 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistakes/typos:

"Allodating" -> "Allocating"
"incative" -> "inactive"

Signed-off-by: Colin Ian King 
---
 drivers/scsi/snic/snic_isr.c  | 4 ++--
 drivers/scsi/snic/snic_scsi.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/snic/snic_isr.c b/drivers/scsi/snic/snic_isr.c
index d859501e4ccd..c4da3673f2ae 100644
--- a/drivers/scsi/snic/snic_isr.c
+++ b/drivers/scsi/snic/snic_isr.c
@@ -141,7 +141,7 @@ snic_request_intr(struct snic *snic)
  snic->msix[i].devid);
if (ret) {
SNIC_HOST_ERR(snic->shost,
- "MSI-X: requrest_irq(%d) failed %d\n",
+ "MSI-X: request_irq(%d) failed %d\n",
  i,
  ret);
snic_free_intr(snic);
@@ -151,7 +151,7 @@ snic_request_intr(struct snic *snic)
}
 
return ret;
-} /* end of snic_requrest_intr */
+} /* end of snic_request_intr */
 
 int
 snic_set_intr_mode(struct snic *snic)
diff --git a/drivers/scsi/snic/snic_scsi.c b/drivers/scsi/snic/snic_scsi.c
index 05c3a7282d4a..d8a376b7882d 100644
--- a/drivers/scsi/snic/snic_scsi.c
+++ b/drivers/scsi/snic/snic_scsi.c
@@ -1260,7 +1260,7 @@ snic_io_cmpl_handler(struct vnic_dev *vdev,
default:
SNIC_BUG_ON(1);
SNIC_SCSI_DBG(snic->shost,
- "Unknown Firmwqre completion request type %d\n",
+ "Unknown Firmware completion request type %d\n",
  fwreq->hdr.type);
break;
}
-- 
2.11.0



[PATCH][scsi-next] scsi: qla2xxx: fix a bunch of typos and spelling mistakes

2017-06-30 Thread Colin King
From: Colin Ian King 

Fix the following typos/spelling mistakes:

"attribure" -> "attribute"
"suppored" -> "supported"
"Symobilic" -> "Symbolic"
"iteself" -> "itself"
"reqeust" -> "request"
"nvme_wait_on_comand" -> "nvme_wait_on_command"
"bount" -> "bound"
"captrue_mask" -> "capture_mask"
"tempelate" -> "template"

..and also unwrap a line to fix a checkpatch warning.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/qla2xxx/qla_attr.c | 2 +-
 drivers/scsi/qla2xxx/qla_bsg.c  | 2 +-
 drivers/scsi/qla2xxx/qla_init.c | 2 +-
 drivers/scsi/qla2xxx/qla_isr.c  | 3 +--
 drivers/scsi/qla2xxx/qla_mbx.c  | 2 +-
 drivers/scsi/qla2xxx/qla_nvme.c | 4 ++--
 drivers/scsi/qla2xxx/qla_nx.c   | 4 ++--
 drivers/scsi/qla2xxx/qla_nx2.c  | 2 +-
 8 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 6dd984203666..08a1feb3a195 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -929,7 +929,7 @@ qla2x00_alloc_sysfs_attr(scsi_qla_host_t *vha)
iter->name, ret);
else
ql_dbg(ql_dbg_init, vha, 0x00f4,
-   "Successfully created sysfs %s binary attribure.\n",
+   "Successfully created sysfs %s binary attribute.\n",
iter->name);
}
 }
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index e093795a0371..2ea0ef93f5cb 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -293,7 +293,7 @@ qla2x00_process_els(struct bsg_job *bsg_job)
if (bsg_job->request_payload.sg_cnt > 1 ||
bsg_job->reply_payload.sg_cnt > 1) {
ql_dbg(ql_dbg_user, vha, 0x7002,
-   "Multiple SG's are not suppored for ELS requests, "
+   "Multiple SG's are not supported for ELS requests, "
"request_sg_cnt=%x reply_sg_cnt=%x.\n",
bsg_job->request_payload.sg_cnt,
bsg_job->reply_payload.sg_cnt);
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 8a5f5ef069ae..072ad1aa5505 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4660,7 +4660,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
} else if (qla2x00_rsnn_nn(vha)) {
/* EMPTY */
ql_dbg(ql_dbg_disc, vha, 0x209b,
-   "Register Symobilic Node Name failed.\n");
+   "Register Symbolic Node Name failed.\n");
if (test_bit(LOOP_RESYNC_NEEDED, 
>dpc_flags))
break;
}
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 011faa1dc618..6c6e624a5aa6 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -432,8 +432,7 @@ qla83xx_handle_8200_aen(scsi_qla_host_t *vha, uint16_t *mb)
"Register: 0x%x%x.\n", mb[7], mb[3]);
if (err_level == ERR_LEVEL_NON_FATAL) {
ql_log(ql_log_warn, vha, 0x5063,
-   "Not a fatal error, f/w has recovered "
-   "iteself.\n");
+   "Not a fatal error, f/w has recovered 
itself.\n");
} else if (err_level == ERR_LEVEL_RECOVERABLE_FATAL) {
ql_log(ql_log_fatal, vha, 0x5064,
"Recoverable Fatal error: Chip reset "
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 0764b6172ed1..7c6d1a404011 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -3893,7 +3893,7 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)
rval = QLA_FUNCTION_FAILED;
} else if (vce->comp_status != cpu_to_le16(CS_COMPLETE)) {
ql_dbg(ql_dbg_mbx, vha, 0x10c5,
-   "Failed to complet IOCB -- completion status (%x).\n",
+   "Failed to complete IOCB -- completion status (%x).\n",
le16_to_cpu(vce->comp_status));
rval = QLA_FUNCTION_FAILED;
} else {
diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index 1da8fa8f641d..53e58e9daba8 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -489,7 +489,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port 
*lport,
struct nvme_private *priv;
 
if (!fd) {
-   ql_log(ql_log_warn, NULL, 0x2134, "NO NVMe FCP reqeust\n");
+   ql_log(ql_log_warn, NULL, 0x2134, "NO NVMe FCP request\n");
return 

[PATCH] scsi: hpsa: fix spelling mistake: "encrypytion" -> "encryption"

2017-06-26 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in dev_info message

Signed-off-by: Colin Ian King 
---
 drivers/scsi/hpsa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 9934947073e6..8914eab84337 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3127,7 +3127,7 @@ static void hpsa_debug_map_buff(struct ctlr_info *h, int 
rc,
le16_to_cpu(map_buff->layout_map_count));
dev_info(>pdev->dev, "flags = 0x%x\n",
le16_to_cpu(map_buff->flags));
-   dev_info(>pdev->dev, "encrypytion = %s\n",
+   dev_info(>pdev->dev, "encryption = %s\n",
le16_to_cpu(map_buff->flags) &
RAID_MAP_FLAG_ENCRYPT_ON ?  "ON" : "OFF");
dev_info(>pdev->dev, "dekindex = %u\n",
-- 
2.11.0



[PATCH] scsi: hptiop: make function hptiop_iop_request_callback_itl static

2017-06-22 Thread Colin King
From: Colin Ian King 

The function hptiop_iop_request_callback_itl does not need to be in
global scope, so make it static.

Cleans up sparse warning:
"symbol 'hptiop_iop_request_callback_itl' was not declared. Should it
 be static?"

Signed-off-by: Colin Ian King 
---
 drivers/scsi/hptiop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index db17ad15b0c1..7226226f7383 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -800,7 +800,7 @@ static void hptiop_host_request_callback_itl(struct 
hptiop_hba *hba, u32 _tag)
hptiop_finish_scsi_req(hba, tag, req);
 }
 
-void hptiop_iop_request_callback_itl(struct hptiop_hba *hba, u32 tag)
+static void hptiop_iop_request_callback_itl(struct hptiop_hba *hba, u32 tag)
 {
struct hpt_iop_request_header __iomem *req;
struct hpt_iop_request_ioctl_command __iomem *p;
-- 
2.11.0



[PATCH][V2][target-devel-next] tcmu: make array tcmu_attrib_attrs static const

2017-06-13 Thread Colin King
From: Colin Ian King 

The array tcmu_attrib_attrs does not need to be in global scope, so make
it static.

Cleans up sparse warning:
"symbol 'tcmu_attrib_attrs' was not declared. Should it be static?"

Signed-off-by: Colin Ian King 
---
 drivers/target/target_core_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_user.c 
b/drivers/target/target_core_user.c
index afc1fd6bacaf..04fb3f720895 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1672,7 +1672,7 @@ static ssize_t tcmu_emulate_write_cache_store(struct 
config_item *item,
 }
 CONFIGFS_ATTR(tcmu_, emulate_write_cache);
 
-struct configfs_attribute *tcmu_attrib_attrs[] = {
+static struct configfs_attribute *tcmu_attrib_attrs[] = {
_attr_cmd_time_out,
_attr_dev_path,
_attr_dev_size,
-- 
2.11.0



[PATCH][target-devel-next] tcmu: make array tcmu_attrib_attrs static const

2017-06-13 Thread Colin King
From: Colin Ian King 

The guid intel_dsm_guid does not need to be in global scope, so make
it static.

Cleans up sparse warning:
"symbol 'tcmu_attrib_attrs' was not declared. Should it be static?"

Signed-off-by: Colin Ian King 
---
 drivers/target/target_core_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_user.c 
b/drivers/target/target_core_user.c
index afc1fd6bacaf..04fb3f720895 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1672,7 +1672,7 @@ static ssize_t tcmu_emulate_write_cache_store(struct 
config_item *item,
 }
 CONFIGFS_ATTR(tcmu_, emulate_write_cache);
 
-struct configfs_attribute *tcmu_attrib_attrs[] = {
+static struct configfs_attribute *tcmu_attrib_attrs[] = {
_attr_cmd_time_out,
_attr_dev_path,
_attr_dev_size,
-- 
2.11.0



[PATCH][scsi-next] scsi: qla2xxx: remove redundant null check on tgt

2017-06-05 Thread Colin King
From: Colin Ian King 

An earlier commit ed7fb808477b846bb2 ("scsi: qla2xxx: Remove
redundant wait when target is stopped.") removed a null check
on ha->tgt.tgt_ops and replaced it with a new check that null
checked tgt, thus making the subsequent null check on tgt
totally redundant. Remove it.

Detected by CoverityScan, CID#1440452 ("Logically Dead Code")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/qla2xxx/qla_target.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index cb33ca87ca37..3594a76f6155 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -5519,12 +5519,6 @@ void qlt_async_event(uint16_t code, struct scsi_qla_host 
*vha,
if (!tgt || tgt->tgt_stop || tgt->tgt_stopped)
return;
 
-   if (unlikely(tgt == NULL)) {
-   ql_dbg(ql_dbg_tgt, vha, 0xe03a,
-   "ASYNC EVENT %#x, but no tgt (ha %p)\n", code, ha);
-   return;
-   }
-
if (((code == MBA_POINT_TO_POINT) || (code == MBA_CHG_IN_CONNECTION)) &&
IS_QLA2100(ha))
return;
-- 
2.11.0



[PATCH] scsi: lpfc: fix spelling mistake "entrys" -> "entries"

2017-05-26 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in debugfs message

Signed-off-by: Colin Ian King 
---
 drivers/scsi/lpfc/lpfc_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 4bcb92c844ca..efd8a17ac2e5 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -323,7 +323,7 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, 
int size)
raw_index = phba->hbq_get[i];
getidx = le32_to_cpu(raw_index);
len +=  snprintf(buf+len, size-len,
-   "entrys:%d bufcnt:%d Put:%d nPut:%d localGet:%d hbaGet:%d\n",
+   "entries:%d bufcnt:%d Put:%d nPut:%d localGet:%d hbaGet:%d\n",
hbqs->entry_count, hbqs->buffer_count, hbqs->hbqPutIdx,
hbqs->next_hbqPutIdx, hbqs->local_hbqGetIdx, getidx);
 
-- 
2.11.0



[PATCH] scsi: lpfc: make a couple of functions static

2017-05-18 Thread Colin King
From: Colin Ian King 

functions lpfc_nvmet_cleanup_io_context and lpfc_nvmet_setup_io_context
can be made static as they do not need to be in global scope.

Cleans up sparse warnings:
  "warning: symbol 'lpfc_nvmet_cleanup_io_context' was not declared.
   Should it be static?"
  "warning: symbol 'lpfc_nvmet_setup_io_context' was not declared.
   Should it be static?"

Signed-off-by: Colin Ian King 
---
 drivers/scsi/lpfc/lpfc_nvmet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c
index f94294b77b7b..469958e3d50a 100644
--- a/drivers/scsi/lpfc/lpfc_nvmet.c
+++ b/drivers/scsi/lpfc/lpfc_nvmet.c
@@ -828,7 +828,7 @@ static struct nvmet_fc_target_template lpfc_tgttemplate = {
.target_priv_sz = sizeof(struct lpfc_nvmet_tgtport),
 };
 
-void
+static void
 lpfc_nvmet_cleanup_io_context(struct lpfc_hba *phba)
 {
struct lpfc_nvmet_ctxbuf *ctx_buf, *next_ctx_buf;
@@ -858,7 +858,7 @@ lpfc_nvmet_cleanup_io_context(struct lpfc_hba *phba)
}
 }
 
-int
+static int
 lpfc_nvmet_setup_io_context(struct lpfc_hba *phba)
 {
struct lpfc_nvmet_ctxbuf *ctx_buf;
-- 
2.11.0



[PATCH] scsi: aacraid: fix leak of data from stack back to userspace

2017-05-15 Thread Colin King
From: Colin Ian King 

The fields sense_data_size and sense_data are unitialized garbage from
the stack and are being copied back to userspace.  Fix this leak of
stack information by ensuring they are zero'd.

Detected by CoverityScan, CID#1435473 ("Uninitialized scalar variable")

Fixes: 423400e64d377 ("scsi: aacraid: Include HBA direct interface")
Signed-off-by: Colin Ian King 
---
 drivers/scsi/aacraid/commctrl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index 106b9332f718..6bb6ed48e31d 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -955,6 +955,8 @@ static int aac_send_raw_srb(struct aac_dev* dev, void 
__user * arg)
reply.srb_status = SRB_STATUS_SUCCESS;
reply.scsi_status = 0;
reply.data_xfer_length = byte_count;
+   reply.sense_data_size = 0;
+   memset(reply.sense_data, 0, AAC_SENSE_BUFFERSIZE);
} else {
reply.srb_status = err->service_response;
reply.scsi_status = err->status;
-- 
2.11.0



[PATCH] target/iscsi: make function target_parse_xcopy_cmd static

2017-05-11 Thread Colin King
From: Colin Ian King 

Making target_parse_xcopy_cmd static fixes sparse warning:

"warning: symbol 'target_parse_xcopy_cmd' was not declared.  Should
it be static?"

Fixes: 1bd05294519f76 ("target/iscsi: Fix a deadlock between the XCOPY code and 
session shutdown")
Signed-off-by: Colin Ian King 
---
 drivers/target/target_core_xcopy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_xcopy.c 
b/drivers/target/target_core_xcopy.c
index aecb36d955f0..00e0269e6be4 100644
--- a/drivers/target/target_core_xcopy.c
+++ b/drivers/target/target_core_xcopy.c
@@ -886,7 +886,7 @@ static void target_xcopy_do_work(struct work_struct *work)
  * Returns TCM_NO_SENSE upon success or a sense code != TCM_NO_SENSE if parsing
  * fails.
  */
-sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop)
+static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop)
 {
struct se_cmd *se_cmd = xop->xop_se_cmd;
unsigned char *p = NULL, *seg_desc;
-- 
2.11.0



[PATCH] scsi: qla4xxx: check for null return from iscsi_lookup_endpoint

2017-05-07 Thread Colin King
From: Colin Ian King 

iscsi_lookup_endpoint can potentially return null and in 9 out of
the 10 calls to this function a null return is checked, so I think
it is pertinent to perform a null check here too and return -EINVAL
as in the other null cases.

Detected by CoverityScan, CID#147282 ("Dereference null return value")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/qla4xxx/ql4_os.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 64c6fa563fdb..803e342e1093 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -3189,6 +3189,8 @@ static int qla4xxx_conn_bind(struct iscsi_cls_session 
*cls_session,
if (iscsi_conn_bind(cls_session, cls_conn, is_leading))
return -EINVAL;
ep = iscsi_lookup_endpoint(transport_fd);
+   if (!ep)
+   return -EINVAL;
conn = cls_conn->dd_data;
qla_conn = conn->dd_data;
qla_conn->qla_ep = ep->dd_data;
-- 
2.11.0



[PATCH] scsi: lpfc: ensure els_wq is being checked before destroying it

2017-05-06 Thread Colin King
From: Colin Ian King 

I believe there is a typo on the wq destroy of els_wq, currently
the driver is checking if els_cq is not null and I think this
should be a check on els_wq instead.

Detected by CoverityScan, CID#1411629 ("Copy-paste error")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/lpfc/lpfc_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 90ae354a9c45..c925bbe9b35d 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8847,7 +8847,7 @@ lpfc_sli4_queue_unset(struct lpfc_hba *phba)
lpfc_wq_destroy(phba, phba->sli4_hba.nvmels_wq);
 
/* Unset ELS work queue */
-   if (phba->sli4_hba.els_cq)
+   if (phba->sli4_hba.els_wq)
lpfc_wq_destroy(phba, phba->sli4_hba.els_wq);
 
/* Unset unsolicited receive queue */
-- 
2.11.0



[PATCH] scsi: pmcraid: remove redundant check to see if request_size is less than zero

2017-05-03 Thread Colin King
From: Colin Ian King 

The 2nd check to see if request_size is less than zero is redundant
because the first check takes error exit path on this condition. So,
since it is redundant, remove it.

Detected by CoverityScan, CID#146149 ("Logically Dead Code")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/pmcraid.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index a4aadf5f4dc6..1cc814f1505a 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -3770,9 +3770,6 @@ static long pmcraid_ioctl_passthrough(
pmcraid_err("couldn't build passthrough ioadls\n");
goto out_free_cmd;
}
-   } else if (request_size < 0) {
-   rc = -EINVAL;
-   goto out_free_cmd;
}
 
/* If data is being written into the device, copy the data from user
-- 
2.11.0



[PATCH] qla4xxx: fix spelling mistake: "Tempalate" -> "Template"

2017-04-25 Thread Colin King
From: Colin Ian King 

trivial fix to spelling mistake in DEBUG2 debug message

Signed-off-by: Colin Ian King 
---
 drivers/scsi/qla4xxx/ql4_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index 4180d6d9fe78..5d6d158bbfd6 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -389,7 +389,7 @@ void qla4xxx_alloc_fw_dump(struct scsi_qla_host *ha)
goto alloc_cleanup;
 
DEBUG2(ql4_printk(KERN_INFO, ha,
- "Minidump Tempalate Size = 0x%x KB\n",
+ "Minidump Template Size = 0x%x KB\n",
  ha->fw_dump_tmplt_size));
DEBUG2(ql4_printk(KERN_INFO, ha,
  "Total Minidump size = 0x%x KB\n", ha->fw_dump_size));
-- 
2.11.0



[PATCH] scsi: stex: make S6flag static

2017-04-25 Thread Colin King
From: Colin Ian King 

This module specific flag can be made static as it does
not need to be in global scope.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/stex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 0751561b59da..9b20643ab49d 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -363,7 +363,7 @@ struct st_card_info {
u16 sts_count;
 };
 
-int S6flag;
+static int S6flag;
 static int stex_halt(struct notifier_block *nb, ulong event, void *buf);
 static struct notifier_block stex_notifier = {
stex_halt, NULL, 0
-- 
2.11.0



[PATCH] scsi: fcoe: make fcoe_e_d_tov and fcoe_r_a_tov static

2017-04-24 Thread Colin King
From: Colin Ian King 

These module parameter variables don't need global scope, make them static

Signed-off-by: Colin Ian King 
---
 drivers/scsi/fcoe/fcoe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index ab7bc1505e0b..90939f66bc0d 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -63,11 +63,11 @@ unsigned int fcoe_debug_logging;
 module_param_named(debug_logging, fcoe_debug_logging, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels");
 
-unsigned int fcoe_e_d_tov = 2 * 1000;
+static unsigned int fcoe_e_d_tov = 2 * 1000;
 module_param_named(e_d_tov, fcoe_e_d_tov, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(e_d_tov, "E_D_TOV in ms, default 2000");
 
-unsigned int fcoe_r_a_tov = 2 * 2 * 1000;
+static unsigned int fcoe_r_a_tov = 2 * 2 * 1000;
 module_param_named(r_a_tov, fcoe_r_a_tov, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(r_a_tov, "R_A_TOV in ms, default 4000");
 
-- 
2.11.0



[PATCH] scsi: fusion: fix spelling mistake: "Persistancy" -> "Persistency"

2017-04-22 Thread Colin King
From: Colin Ian King 

trivial fix to spelling mistake

Signed-off-by: Colin Ian King 
---
 drivers/message/fusion/mptbase.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 1e73064b0fb2..62cff5afc6bd 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -7396,7 +7396,7 @@ mpt_display_event_info(MPT_ADAPTER *ioc, 
EventNotificationReply_t *pEventReply)
break;
case MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED:
snprintf(evStr, EVENT_DESCR_STR_SZ,
-   "SAS Device Status Change: No Persistancy: "
+   "SAS Device Status Change: No Persistency: "
"id=%d channel=%d", id, channel);
break;
case MPI_EVENT_SAS_DEV_STAT_RC_UNSUPPORTED:
-- 
2.11.0



[PATCH] [SCSI] aic7xxx: remove redundant assignment to error

2017-04-18 Thread Colin King
From: Colin Ian King 

error is initially assigned to ENOENT and a few statements later
is re-assigned to the error return from the call to ahd_wait_seeprom,
hence the initial assignment is redundant and can be removed.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/aic7xxx/aic79xx_core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c 
b/drivers/scsi/aic7xxx/aic79xx_core.c
index 95d8f25cbcca..f5a2714ed82c 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -10077,7 +10077,6 @@ ahd_write_seeprom(struct ahd_softc *ahd, uint16_t *buf,
int   retval;
 
AHD_ASSERT_MODES(ahd, AHD_MODE_SCSI_MSK, AHD_MODE_SCSI_MSK);
-   error = ENOENT;
 
/* Place the chip into write-enable mode */
ahd_outb(ahd, SEEADR, SEEOP_EWEN_ADDR);
-- 
2.11.0



[PATCH] scsi: fc: remove redundant check of an unsigned long being less than zero

2017-04-14 Thread Colin King
From: Colin Ian King 

The check for an unsigned long being less than zero is always false
so it is a redundant check and can be removed.

Detected by static analysis with by PVS-Studio

Signed-off-by: Colin Ian King 
---
 drivers/scsi/scsi_transport_fc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 2d753c93e07a..87b8f9d64d9b 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -850,7 +850,7 @@ static int fc_str_to_dev_loss(const char *buf, unsigned 
long *val)
char *cp;
 
*val = simple_strtoul(buf, , 0);
-   if ((*cp && (*cp != '\n')) || (*val < 0))
+   if (*cp && (*cp != '\n'))
return -EINVAL;
/*
 * Check for overflow; dev_loss_tmo is u32
-- 
2.11.0



[PATCH] snic: fix spelling mistake: "Cann't" -> "Cannot"

2017-04-12 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in SNIC_ERR error message text,
one cannot have "Cann't".

Signed-off-by: Colin Ian King 
---
 drivers/scsi/snic/snic_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/snic/snic_debugfs.c b/drivers/scsi/snic/snic_debugfs.c
index d30280326bde..269ddf791a73 100644
--- a/drivers/scsi/snic/snic_debugfs.c
+++ b/drivers/scsi/snic/snic_debugfs.c
@@ -548,7 +548,7 @@ snic_trc_debugfs_init(void)
 _trc_fops);
 
if (!de) {
-   SNIC_ERR("Cann't create trace file.\n");
+   SNIC_ERR("Cannot create trace file.\n");
 
return ret;
}
-- 
2.11.0



[PATCH] [SCSI] aic7xxx: fix order of arguments in function prototype

2017-04-08 Thread Colin King
From: Colin Ian King 

The vendor/device and subvendor/subdevice arguments to the function
prototype ahc_9005_subdevinfo_valid are in the wrong order and
need to be swapped to fix this.  Detected with PVS-Studio studio.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/aic7xxx/aic7xxx_pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic7xxx_pci.c 
b/drivers/scsi/aic7xxx/aic7xxx_pci.c
index 22d5a949ec83..673e826d7adb 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_pci.c
@@ -601,8 +601,8 @@ static const u_int ahc_num_pci_devs = 
ARRAY_SIZE(ahc_pci_ident_table);
 #define STA0x08
 #define DPR0x01
 
-static int ahc_9005_subdevinfo_valid(uint16_t vendor, uint16_t device,
-uint16_t subvendor, uint16_t subdevice);
+static int ahc_9005_subdevinfo_valid(uint16_t device, uint16_t vendor,
+uint16_t subdevice, uint16_t subvendor);
 static int ahc_ext_scbram_present(struct ahc_softc *ahc);
 static void ahc_scbram_config(struct ahc_softc *ahc, int enable,
  int pcheck, int fast, int large);
-- 
2.11.0



[PATCH] scsi: qla2xxx: remove some redundant pointer assignments

2017-04-06 Thread Colin King
From: Colin Ian King 

There are several local or function parameter pointers that are
being assigned NULL after a kfree where and these have no effect
and hence can be removed.

Fixes various cppcheck warnings:

"Assignment of function parameter has no effect outside the
function. Did you forget dereferencing it"

Signed-off-by: Colin Ian King 
---
 drivers/scsi/qla2xxx/qla_os.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 83d61d2142e9..1c7957903283 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -423,7 +423,6 @@ static void qla2x00_free_req_que(struct qla_hw_data *ha, 
struct req_que *req)
kfree(req->outstanding_cmds);
 
kfree(req);
-   req = NULL;
 }
 
 static void qla2x00_free_rsp_que(struct qla_hw_data *ha, struct rsp_que *rsp)
@@ -439,7 +438,6 @@ static void qla2x00_free_rsp_que(struct qla_hw_data *ha, 
struct rsp_que *rsp)
rsp->ring, rsp->dma);
}
kfree(rsp);
-   rsp = NULL;
 }
 
 static void qla2x00_free_queues(struct qla_hw_data *ha)
@@ -653,7 +651,6 @@ qla2x00_sp_free_dma(void *ptr)
ha->gbl_dsd_inuse -= ctx1->dsd_use_cnt;
ha->gbl_dsd_avail += ctx1->dsd_use_cnt;
mempool_free(ctx1, ha->ctx_mempool);
-   ctx1 = NULL;
}
 
CMD_SP(cmd) = NULL;
@@ -3256,7 +3253,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct 
pci_device_id *id)
}
pci_release_selected_regions(ha->pdev, ha->bars);
kfree(ha);
-   ha = NULL;
 
 probe_out:
pci_disable_device(pdev);
@@ -3504,7 +3500,6 @@ qla2x00_remove_one(struct pci_dev *pdev)
 
pci_release_selected_regions(ha->pdev, ha->bars);
kfree(ha);
-   ha = NULL;
 
pci_disable_pcie_error_reporting(pdev);
 
@@ -3568,7 +3563,6 @@ void qla2x00_free_fcports(struct scsi_qla_host *vha)
list_del(>list);
qla2x00_clear_loop_id(fcport);
kfree(fcport);
-   fcport = NULL;
}
 }
 
-- 
2.11.0



[PATCH] scsi: hisi_sas: add missing break in switch statement

2017-03-28 Thread Colin King
From: Colin Ian King 

It appears that a break in the TRANS_TX_OPEN_CNX_ERR_NO_DESTINATION
case got accidentally removed in an earlier commit, as it stands,
the ts->stat and ts->open_rej_reason are being updated twice for this
case which looks incorrect.  Fix this by adding in the missing break
statement.

Detected by CoverityScan, CID#1422110 ("Missing break in switch")

Fixes: 634a9585f49c7 ("scsi: hisi_sas: process error codes according to their 
priority")
Signed-off-by: Colin Ian King 
---
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c 
b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index a3af380dde9e..66c2de8b7b64 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -1709,6 +1709,7 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba,
{
ts->stat = SAS_OPEN_REJECT;
ts->open_rej_reason = SAS_OREJ_NO_DEST;
+   break;
}
case TRANS_TX_OPEN_CNX_ERR_PROTOCOL_NOT_SUPPORTED:
{
-- 
2.11.0



[PATCH] qla2xxx: remove redundant check on sess being non-null

2017-03-23 Thread Colin King
From: Colin Ian King 

All error paths to label out_term2 result in sess being null, so the
check for sess being non-null and the call to put_sess is dead code
and can therefore be removed.

Detected with CoverityScan, CID#1420664 ("Logically dead code")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/qla2xxx/qla_target.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 0e03ca2ab3e5..32e07f21ddb2 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -5853,8 +5853,6 @@ static void qlt_abort_work(struct qla_tgt *tgt,
return;
 
 out_term2:
-   if (sess)
-   ha->tgt.tgt_ops->put_sess(sess);
spin_unlock_irqrestore(>tgt.sess_lock, flags2);
 
 out_term:
-- 
2.11.0



[PATCH] scsi: pm8001: build in relevant functions and code on PM8001_USE_MSIX

2017-03-22 Thread Colin King
From: Colin Ian King 

Currently the misx and intx variables of the interrupt enable/disable
helper functions are built in no matter what the setting of the
macro PM8001_USE_MSIX.  Clean this up by just building in the
necessary helper functions and calls to these functions depending on
the setting of PM8001_USE_MSIX.  This addresses several dead code
paths found by static analysis with CoverityScan.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/pm8001/pm8001_hwi.c | 63 +---
 1 file changed, 33 insertions(+), 30 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index 10546faac58c..d1be10fd1350 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -1204,26 +1204,7 @@ void pm8001_chip_iounmap(struct pm8001_hba_info 
*pm8001_ha)
}
 }
 
-/**
- * pm8001_chip_interrupt_enable - enable PM8001 chip interrupt
- * @pm8001_ha: our hba card information
- */
-static void
-pm8001_chip_intx_interrupt_enable(struct pm8001_hba_info *pm8001_ha)
-{
-   pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_CLEAR_ALL);
-   pm8001_cw32(pm8001_ha, 0, MSGU_ODCR, ODCR_CLEAR_ALL);
-}
-
- /**
-  * pm8001_chip_intx_interrupt_disable- disable PM8001 chip interrupt
-  * @pm8001_ha: our hba card information
-  */
-static void
-pm8001_chip_intx_interrupt_disable(struct pm8001_hba_info *pm8001_ha)
-{
-   pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_MASK_ALL);
-}
+#ifdef PM8001_USE_MSIX
 
 /**
  * pm8001_chip_msix_interrupt_enable - enable PM8001 chip interrupt
@@ -1257,6 +1238,30 @@ pm8001_chip_msix_interrupt_disable(struct 
pm8001_hba_info *pm8001_ha,
pm8001_cw32(pm8001_ha, 0,  msi_index, MSIX_INTERRUPT_DISABLE);
 }
 
+#else
+
+/**
+ * pm8001_chip_interrupt_enable - enable PM8001 chip interrupt
+ * @pm8001_ha: our hba card information
+ */
+static void
+pm8001_chip_intx_interrupt_enable(struct pm8001_hba_info *pm8001_ha)
+{
+   pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_CLEAR_ALL);
+   pm8001_cw32(pm8001_ha, 0, MSGU_ODCR, ODCR_CLEAR_ALL);
+}
+
+ /**
+  * pm8001_chip_intx_interrupt_disable- disable PM8001 chip interrupt
+  * @pm8001_ha: our hba card information
+  */
+static void
+pm8001_chip_intx_interrupt_disable(struct pm8001_hba_info *pm8001_ha)
+{
+   pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_MASK_ALL);
+}
+#endif
+
 /**
  * pm8001_chip_interrupt_enable - enable PM8001 chip interrupt
  * @pm8001_ha: our hba card information
@@ -1266,10 +1271,9 @@ pm8001_chip_interrupt_enable(struct pm8001_hba_info 
*pm8001_ha, u8 vec)
 {
 #ifdef PM8001_USE_MSIX
pm8001_chip_msix_interrupt_enable(pm8001_ha, 0);
-   return;
-#endif
+#else
pm8001_chip_intx_interrupt_enable(pm8001_ha);
-
+#endif
 }
 
 /**
@@ -1281,10 +1285,9 @@ pm8001_chip_interrupt_disable(struct pm8001_hba_info 
*pm8001_ha, u8 vec)
 {
 #ifdef PM8001_USE_MSIX
pm8001_chip_msix_interrupt_disable(pm8001_ha, 0);
-   return;
-#endif
+#else
pm8001_chip_intx_interrupt_disable(pm8001_ha);
-
+#endif
 }
 
 /**
@@ -4613,15 +4616,15 @@ static int pm8001_chip_phy_ctl_req(struct 
pm8001_hba_info *pm8001_ha,
 
 static u32 pm8001_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha)
 {
-   u32 value;
 #ifdef PM8001_USE_MSIX
return 1;
-#endif
-   value = pm8001_cr32(pm8001_ha, 0, MSGU_ODR);
+#else
+   u32 value = pm8001_cr32(pm8001_ha, 0, MSGU_ODR);
+
if (value)
return 1;
return 0;
-
+#endif
 }
 
 /**
-- 
2.11.0



[PATCH] scsi: fcoe: sanity check string size for store_ctrl_mode option

2017-03-22 Thread Colin King
From: Colin Ian King 

Reading and writing to mode[count - 1] implies the count should not
be less than 1 so add a sanity check for this.

Detected with CoverityScan, CID#1357345 ("Overflowed array index write")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/fcoe/fcoe_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
index 9cf3d56296ab..e298240c728c 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -288,7 +288,7 @@ static ssize_t store_ctlr_mode(struct device *dev,
struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev);
char mode[FCOE_MAX_MODENAME_LEN + 1];
 
-   if (count > FCOE_MAX_MODENAME_LEN)
+   if (count < 1 || count > FCOE_MAX_MODENAME_LEN)
return -EINVAL;
 
strncpy(mode, buf, count);
-- 
2.11.0



[PATCH] [SCSI] esas2r: remove redundant NULL check on buffer

2017-03-15 Thread Colin King
From: Colin Ian King 

buffer is a pointer to the static char array event_buffer and
therefore can never be null, so the check is redundant. Remove it.

Detected by CoverityScan, CID#1077556 ("Logically Dead Code")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/esas2r/esas2r_log.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/scsi/esas2r/esas2r_log.c b/drivers/scsi/esas2r/esas2r_log.c
index a82030a..65fdf22 100644
--- a/drivers/scsi/esas2r/esas2r_log.c
+++ b/drivers/scsi/esas2r/esas2r_log.c
@@ -130,11 +130,6 @@ static int esas2r_log_master(const long level,
 
spin_lock_irqsave(_buffer_lock, flags);
 
-   if (buffer == NULL) {
-   spin_unlock_irqrestore(_buffer_lock, flags);
-   return -1;
-   }
-
memset(buffer, 0, buflen);
 
/*
-- 
2.10.2



[PATCH][V2] scsi: cxgb3i: remove redundant null check and kfree on skb

2017-03-14 Thread Colin King
From: Colin Ian King 

On the error exit path, skb is always null, so the non-null check
and __kfree_skb call are redundant.  Remove the redundant code and
just directly return with the appropriate error return code.

Detected by CoverityScan, CID#114328 ("Logically Dead Code")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c 
b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
index 1880eb6..3c9f8cf2 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -979,14 +979,14 @@ static int init_act_open(struct cxgbi_sock *csk)
csk->atid = cxgb3_alloc_atid(t3dev, _client, csk);
if (csk->atid < 0) {
pr_err("NO atid available.\n");
-   goto rel_resource;
+   return -EINVAL;
}
cxgbi_sock_set_flag(csk, CTPF_HAS_ATID);
cxgbi_sock_get(csk);
 
skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL);
if (!skb)
-   goto rel_resource;
+   return -ENOMEM;
skb->sk = (struct sock *)csk;
set_arp_failure_handler(skb, act_open_arp_failure);
csk->snd_win = cxgb3i_snd_win;
@@ -1007,11 +1007,6 @@ static int init_act_open(struct cxgbi_sock *csk)
cxgbi_sock_set_state(csk, CTP_ACTIVE_OPEN);
send_act_open_req(csk, skb, csk->l2t);
return 0;
-
-rel_resource:
-   if (skb)
-   __kfree_skb(skb);
-   return -EINVAL;
 }
 
 cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS] = {
-- 
2.10.2



[PATCH] scsi: cxgb3i: remove redundant null check and kfree on skb

2017-03-13 Thread Colin King
From: Colin Ian King 

On the error exit path, skb is always null, so the non-null check
and __kfree_skb call are redundant.  Remove the redundant code,
rename the rel_release label to err and make error paths jump to
the err exit path.

Detected by CoverityScan, CID#114328 ("Logically Dead Code")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c 
b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
index 1880eb6..f453a78 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -972,21 +972,21 @@ static int init_act_open(struct cxgbi_sock *csk)
  >daddr.sin_addr.s_addr);
if (!csk->l2t) {
pr_err("NO l2t available.\n");
-   return -EINVAL;
+   goto err;
}
cxgbi_sock_get(csk);
 
csk->atid = cxgb3_alloc_atid(t3dev, _client, csk);
if (csk->atid < 0) {
pr_err("NO atid available.\n");
-   goto rel_resource;
+   goto err;
}
cxgbi_sock_set_flag(csk, CTPF_HAS_ATID);
cxgbi_sock_get(csk);
 
skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL);
if (!skb)
-   goto rel_resource;
+   goto err;
skb->sk = (struct sock *)csk;
set_arp_failure_handler(skb, act_open_arp_failure);
csk->snd_win = cxgb3i_snd_win;
@@ -1008,9 +1008,7 @@ static int init_act_open(struct cxgbi_sock *csk)
send_act_open_req(csk, skb, csk->l2t);
return 0;
 
-rel_resource:
-   if (skb)
-   __kfree_skb(skb);
+err:
return -EINVAL;
 }
 
-- 
2.10.2



[PATCH] scsi: qedi: fix missing return error code check on call to qedi_setup_int

2017-02-28 Thread Colin King
From: Colin Ian King 

The call to qedi_setup_int is not updating the return code rc yet rc
is being checked for an error. Fix this by assigning rc to the return
code from the call to qedi_setup_int.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/qedi/qedi_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index 5eda21d..8e3d928 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -1805,7 +1805,7 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)
 */
qedi_ops->common->update_pf_params(qedi->cdev, >pf_params);
 
-   qedi_setup_int(qedi);
+   rc = qedi_setup_int(qedi);
if (rc)
goto stop_iscsi_func;
 
-- 
2.10.2



[PATCH] scsi: aacraid: remove redundant zero check on ret

2017-02-24 Thread Colin King
From: Colin Ian King 

The check for ret being zero is redundant as a few statements earlier
we break out of the while loop if ret is non-zero.  Thus we can
remove the zero check and also the dead-code non-zero case too.

Detected by CoverityScan, CID#1411632 ("Logically Dead Code")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/aacraid/commsup.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 1994c74..a3ad042 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -2508,8 +2508,7 @@ int aac_command_thread(void *data)
 && (now.tv_usec > (100 / HZ)))
difference = (((100 - now.tv_usec) * HZ)
  + 50) / 100;
-   else if (ret == 0) {
-
+   else {
if (now.tv_usec > 50)
++now.tv_sec;
 
@@ -2520,9 +2519,6 @@ int aac_command_thread(void *data)
ret = aac_send_hosttime(dev, );
 
difference = (long)(unsigned)update_interval*HZ;
-   } else {
-   /* retry shortly */
-   difference = 10 * HZ;
}
next_jiffies = jiffies + difference;
if (time_before(next_check_jiffies,next_jiffies))
-- 
2.10.2



[PATCH] scsi: lpfc: fix missing spin_unlock on sql_list_lock

2017-02-24 Thread Colin King
From: Colin Ian King 

In the case where sglq is null, the current code just returns without
unlocking the spinlock sql_list_lock. Fix this by breaking out of the
while loop and the exit path will then unlock and return NULL as was
the original intention.

Detected by CoverityScan, CID#1411635 ("Missing unlock")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/lpfc/lpfc_sli.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 1fba5dc..40720bb 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -952,7 +952,7 @@ __lpfc_sli_get_els_sglq(struct lpfc_hba *phba, struct 
lpfc_iocbq *piocbq)
start_sglq = sglq;
while (!found) {
if (!sglq)
-   return NULL;
+   break;
if (ndlp && ndlp->active_rrqs_xri_bitmap &&
test_bit(sglq->sli4_lxritag,
ndlp->active_rrqs_xri_bitmap)) {
-- 
2.10.2



[PATCH] scsi: lpfc: don't dereference dma_buf->iocbq before null check

2017-02-24 Thread Colin King
From: Colin Ian King 

dma_buf->iocbq is being dereferenced immediately before it is
being null checked, so we have a potential null pointer dereference
bug.  Fix this by only dereferencing it only once we have passed
a null check on the pointer.

Detected by CoverityScan, CID#1411652 ("Dereference before null check")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/lpfc/lpfc_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
index c61d8d6..5986c79 100644
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.c
@@ -646,7 +646,6 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba)
}
 
dma_buf->iocbq = lpfc_sli_get_iocbq(phba);
-   dma_buf->iocbq->iocb_flag = LPFC_IO_NVMET;
if (!dma_buf->iocbq) {
kfree(dma_buf->context);
pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
@@ -658,6 +657,7 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba)
"2621 Ran out of nvmet iocb/WQEs\n");
return NULL;
}
+   dma_buf->iocbq->iocb_flag = LPFC_IO_NVMET;
nvmewqe = dma_buf->iocbq;
wqe = (union lpfc_wqe128 *)>wqe;
/* Initialize WQE */
-- 
2.10.2



[PATCH] scsi: lpfc: sanity check hrq is null before dereferencing it

2017-02-24 Thread Colin King
From: Colin Ian King 

The sanity check for hrq should be moved to before the deference
of hrq to ensure we don't perform a null pointer deference.

Detected by CoverityScan, CID#1411650 ("Dereference before null check")

Signed-off-by: Colin Ian King 
---
 drivers/scsi/lpfc/lpfc_sli.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index e43e5e2..1fba5dc 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -15185,17 +15185,17 @@ lpfc_mrq_create(struct lpfc_hba *phba, struct 
lpfc_queue **hrqp,
drq = drqp[idx];
cq  = cqp[idx];
 
-   if (hrq->entry_count != drq->entry_count) {
-   status = -EINVAL;
-   goto out;
-   }
-
/* sanity check on queue memory */
if (!hrq || !drq || !cq) {
status = -ENODEV;
goto out;
}
 
+   if (hrq->entry_count != drq->entry_count) {
+   status = -EINVAL;
+   goto out;
+   }
+
if (idx == 0) {
bf_set(lpfc_mbx_rq_create_num_pages,
   _create->u.request,
-- 
2.10.2



  1   2   >