aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_bsg.c5
-rw-r--r--drivers/scsi/lpfc/lpfc_ct.c14
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c16
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c10
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c21
8 files changed, 25 insertions, 49 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 6eed9e76a166..2f9b96826ac0 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -3385,7 +3385,7 @@ lpfc_stat_data_ctrl_store(struct device *dev, struct device_attribute *attr,
3385 if (strlen(buf) > (LPFC_MAX_DATA_CTRL_LEN - 1)) 3385 if (strlen(buf) > (LPFC_MAX_DATA_CTRL_LEN - 1))
3386 return -EINVAL; 3386 return -EINVAL;
3387 3387
3388 strcpy(bucket_data, buf); 3388 strncpy(bucket_data, buf, LPFC_MAX_DATA_CTRL_LEN);
3389 str_ptr = &bucket_data[0]; 3389 str_ptr = &bucket_data[0];
3390 /* Ignore this token - this is command token */ 3390 /* Ignore this token - this is command token */
3391 token = strsep(&str_ptr, "\t "); 3391 token = strsep(&str_ptr, "\t ");
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index a58bffb3f68f..a7bf359aa0c6 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -656,7 +656,6 @@ lpfc_bsg_rport_els(struct fc_bsg_job *job)
656 struct lpfc_nodelist *ndlp = rdata->pnode; 656 struct lpfc_nodelist *ndlp = rdata->pnode;
657 uint32_t elscmd; 657 uint32_t elscmd;
658 uint32_t cmdsize; 658 uint32_t cmdsize;
659 uint32_t rspsize;
660 struct lpfc_iocbq *cmdiocbq; 659 struct lpfc_iocbq *cmdiocbq;
661 uint16_t rpi = 0; 660 uint16_t rpi = 0;
662 struct bsg_job_data *dd_data; 661 struct bsg_job_data *dd_data;
@@ -687,7 +686,6 @@ lpfc_bsg_rport_els(struct fc_bsg_job *job)
687 686
688 elscmd = job->request->rqst_data.r_els.els_code; 687 elscmd = job->request->rqst_data.r_els.els_code;
689 cmdsize = job->request_payload.payload_len; 688 cmdsize = job->request_payload.payload_len;
690 rspsize = job->reply_payload.payload_len;
691 689
692 if (!lpfc_nlp_get(ndlp)) { 690 if (!lpfc_nlp_get(ndlp)) {
693 rc = -ENODEV; 691 rc = -ENODEV;
@@ -2251,7 +2249,6 @@ lpfc_sli4_bsg_diag_mode_end(struct fc_bsg_job *job)
2251 i = 0; 2249 i = 0;
2252 while (phba->link_state != LPFC_LINK_DOWN) { 2250 while (phba->link_state != LPFC_LINK_DOWN) {
2253 if (i++ > timeout) { 2251 if (i++ > timeout) {
2254 rc = -ETIMEDOUT;
2255 lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, 2252 lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC,
2256 "3140 Timeout waiting for link to " 2253 "3140 Timeout waiting for link to "
2257 "diagnostic mode_end, timeout:%d ms\n", 2254 "diagnostic mode_end, timeout:%d ms\n",
@@ -2291,7 +2288,6 @@ lpfc_sli4_bsg_link_diag_test(struct fc_bsg_job *job)
2291 LPFC_MBOXQ_t *pmboxq; 2288 LPFC_MBOXQ_t *pmboxq;
2292 struct sli4_link_diag *link_diag_test_cmd; 2289 struct sli4_link_diag *link_diag_test_cmd;
2293 uint32_t req_len, alloc_len; 2290 uint32_t req_len, alloc_len;
2294 uint32_t timeout;
2295 struct lpfc_mbx_run_link_diag_test *run_link_diag_test; 2291 struct lpfc_mbx_run_link_diag_test *run_link_diag_test;
2296 union lpfc_sli4_cfg_shdr *shdr; 2292 union lpfc_sli4_cfg_shdr *shdr;
2297 uint32_t shdr_status, shdr_add_status; 2293 uint32_t shdr_status, shdr_add_status;
@@ -2342,7 +2338,6 @@ lpfc_sli4_bsg_link_diag_test(struct fc_bsg_job *job)
2342 2338
2343 link_diag_test_cmd = (struct sli4_link_diag *) 2339 link_diag_test_cmd = (struct sli4_link_diag *)
2344 job->request->rqst_data.h_vendor.vendor_cmd; 2340 job->request->rqst_data.h_vendor.vendor_cmd;
2345 timeout = link_diag_test_cmd->timeout * 100;
2346 2341
2347 rc = lpfc_sli4_bsg_set_link_diag_state(phba, 1); 2342 rc = lpfc_sli4_bsg_set_link_diag_state(phba, 1);
2348 2343
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index da61d8dc0449..61a32cd23f79 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -1439,7 +1439,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
1439 /* #2 HBA attribute entry */ 1439 /* #2 HBA attribute entry */
1440 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size); 1440 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size);
1441 ae->ad.bits.AttrType = be16_to_cpu(MANUFACTURER); 1441 ae->ad.bits.AttrType = be16_to_cpu(MANUFACTURER);
1442 strcpy(ae->un.Manufacturer, "Emulex Corporation"); 1442 strncpy(ae->un.Manufacturer, "Emulex Corporation", 64);
1443 len = strlen(ae->un.Manufacturer); 1443 len = strlen(ae->un.Manufacturer);
1444 len += (len & 3) ? (4 - (len & 3)) : 4; 1444 len += (len & 3) ? (4 - (len & 3)) : 4;
1445 ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + len); 1445 ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + len);
@@ -1449,7 +1449,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
1449 /* #3 HBA attribute entry */ 1449 /* #3 HBA attribute entry */
1450 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size); 1450 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size);
1451 ae->ad.bits.AttrType = be16_to_cpu(SERIAL_NUMBER); 1451 ae->ad.bits.AttrType = be16_to_cpu(SERIAL_NUMBER);
1452 strcpy(ae->un.SerialNumber, phba->SerialNumber); 1452 strncpy(ae->un.SerialNumber, phba->SerialNumber, 64);
1453 len = strlen(ae->un.SerialNumber); 1453 len = strlen(ae->un.SerialNumber);
1454 len += (len & 3) ? (4 - (len & 3)) : 4; 1454 len += (len & 3) ? (4 - (len & 3)) : 4;
1455 ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + len); 1455 ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + len);
@@ -1459,7 +1459,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
1459 /* #4 HBA attribute entry */ 1459 /* #4 HBA attribute entry */
1460 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size); 1460 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size);
1461 ae->ad.bits.AttrType = be16_to_cpu(MODEL); 1461 ae->ad.bits.AttrType = be16_to_cpu(MODEL);
1462 strcpy(ae->un.Model, phba->ModelName); 1462 strncpy(ae->un.Model, phba->ModelName, 256);
1463 len = strlen(ae->un.Model); 1463 len = strlen(ae->un.Model);
1464 len += (len & 3) ? (4 - (len & 3)) : 4; 1464 len += (len & 3) ? (4 - (len & 3)) : 4;
1465 ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + len); 1465 ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + len);
@@ -1469,7 +1469,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
1469 /* #5 HBA attribute entry */ 1469 /* #5 HBA attribute entry */
1470 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size); 1470 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size);
1471 ae->ad.bits.AttrType = be16_to_cpu(MODEL_DESCRIPTION); 1471 ae->ad.bits.AttrType = be16_to_cpu(MODEL_DESCRIPTION);
1472 strcpy(ae->un.ModelDescription, phba->ModelDesc); 1472 strncpy(ae->un.ModelDescription, phba->ModelDesc, 256);
1473 len = strlen(ae->un.ModelDescription); 1473 len = strlen(ae->un.ModelDescription);
1474 len += (len & 3) ? (4 - (len & 3)) : 4; 1474 len += (len & 3) ? (4 - (len & 3)) : 4;
1475 ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + len); 1475 ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + len);
@@ -1500,7 +1500,8 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
1500 /* #7 HBA attribute entry */ 1500 /* #7 HBA attribute entry */
1501 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size); 1501 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size);
1502 ae->ad.bits.AttrType = be16_to_cpu(DRIVER_VERSION); 1502 ae->ad.bits.AttrType = be16_to_cpu(DRIVER_VERSION);
1503 strcpy(ae->un.DriverVersion, lpfc_release_version); 1503 strncpy(ae->un.DriverVersion,
1504 lpfc_release_version, 256);
1504 len = strlen(ae->un.DriverVersion); 1505 len = strlen(ae->un.DriverVersion);
1505 len += (len & 3) ? (4 - (len & 3)) : 4; 1506 len += (len & 3) ? (4 - (len & 3)) : 4;
1506 ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + len); 1507 ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + len);
@@ -1510,7 +1511,8 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
1510 /* #8 HBA attribute entry */ 1511 /* #8 HBA attribute entry */
1511 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size); 1512 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size);
1512 ae->ad.bits.AttrType = be16_to_cpu(OPTION_ROM_VERSION); 1513 ae->ad.bits.AttrType = be16_to_cpu(OPTION_ROM_VERSION);
1513 strcpy(ae->un.OptionROMVersion, phba->OptionROMVersion); 1514 strncpy(ae->un.OptionROMVersion,
1515 phba->OptionROMVersion, 256);
1514 len = strlen(ae->un.OptionROMVersion); 1516 len = strlen(ae->un.OptionROMVersion);
1515 len += (len & 3) ? (4 - (len & 3)) : 4; 1517 len += (len & 3) ? (4 - (len & 3)) : 4;
1516 ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + len); 1518 ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + len);
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index b0aedce3f54b..786a2aff7b59 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -269,7 +269,7 @@ static int
269lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) 269lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size)
270{ 270{
271 int len = 0; 271 int len = 0;
272 int cnt, i, j, found, posted, low; 272 int i, j, found, posted, low;
273 uint32_t phys, raw_index, getidx; 273 uint32_t phys, raw_index, getidx;
274 struct lpfc_hbq_init *hip; 274 struct lpfc_hbq_init *hip;
275 struct hbq_s *hbqs; 275 struct hbq_s *hbqs;
@@ -279,7 +279,7 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size)
279 279
280 if (phba->sli_rev != 3) 280 if (phba->sli_rev != 3)
281 return 0; 281 return 0;
282 cnt = LPFC_HBQINFO_SIZE; 282
283 spin_lock_irq(&phba->hbalock); 283 spin_lock_irq(&phba->hbalock);
284 284
285 /* toggle between multiple hbqs, if any */ 285 /* toggle between multiple hbqs, if any */
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index c7e508085413..4c25485aa934 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -1829,7 +1829,7 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1829 IOCB_t *irsp; 1829 IOCB_t *irsp;
1830 struct lpfc_nodelist *ndlp; 1830 struct lpfc_nodelist *ndlp;
1831 struct lpfc_dmabuf *prsp; 1831 struct lpfc_dmabuf *prsp;
1832 int disc, rc, did, type; 1832 int disc, rc;
1833 1833
1834 /* we pass cmdiocb to state machine which needs rspiocb as well */ 1834 /* we pass cmdiocb to state machine which needs rspiocb as well */
1835 cmdiocb->context_un.rsp_iocb = rspiocb; 1835 cmdiocb->context_un.rsp_iocb = rspiocb;
@@ -1874,10 +1874,6 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1874 goto out; 1874 goto out;
1875 } 1875 }
1876 1876
1877 /* ndlp could be freed in DSM, save these values now */
1878 type = ndlp->nlp_type;
1879 did = ndlp->nlp_DID;
1880
1881 if (irsp->ulpStatus) { 1877 if (irsp->ulpStatus) {
1882 /* Check for retry */ 1878 /* Check for retry */
1883 if (lpfc_els_retry(phba, cmdiocb, rspiocb)) { 1879 if (lpfc_els_retry(phba, cmdiocb, rspiocb)) {
@@ -2270,8 +2266,6 @@ lpfc_adisc_done(struct lpfc_vport *vport)
2270void 2266void
2271lpfc_more_adisc(struct lpfc_vport *vport) 2267lpfc_more_adisc(struct lpfc_vport *vport)
2272{ 2268{
2273 int sentadisc;
2274
2275 if (vport->num_disc_nodes) 2269 if (vport->num_disc_nodes)
2276 vport->num_disc_nodes--; 2270 vport->num_disc_nodes--;
2277 /* Continue discovery with <num_disc_nodes> ADISCs to go */ 2271 /* Continue discovery with <num_disc_nodes> ADISCs to go */
@@ -2284,7 +2278,7 @@ lpfc_more_adisc(struct lpfc_vport *vport)
2284 if (vport->fc_flag & FC_NLP_MORE) { 2278 if (vport->fc_flag & FC_NLP_MORE) {
2285 lpfc_set_disctmo(vport); 2279 lpfc_set_disctmo(vport);
2286 /* go thru NPR nodes and issue any remaining ELS ADISCs */ 2280 /* go thru NPR nodes and issue any remaining ELS ADISCs */
2287 sentadisc = lpfc_els_disc_adisc(vport); 2281 lpfc_els_disc_adisc(vport);
2288 } 2282 }
2289 if (!vport->num_disc_nodes) 2283 if (!vport->num_disc_nodes)
2290 lpfc_adisc_done(vport); 2284 lpfc_adisc_done(vport);
@@ -3028,10 +3022,9 @@ lpfc_els_retry_delay_handler(struct lpfc_nodelist *ndlp)
3028{ 3022{
3029 struct lpfc_vport *vport = ndlp->vport; 3023 struct lpfc_vport *vport = ndlp->vport;
3030 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 3024 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
3031 uint32_t cmd, did, retry; 3025 uint32_t cmd, retry;
3032 3026
3033 spin_lock_irq(shost->host_lock); 3027 spin_lock_irq(shost->host_lock);
3034 did = ndlp->nlp_DID;
3035 cmd = ndlp->nlp_last_elscmd; 3028 cmd = ndlp->nlp_last_elscmd;
3036 ndlp->nlp_last_elscmd = 0; 3029 ndlp->nlp_last_elscmd = 0;
3037 3030
@@ -5289,10 +5282,9 @@ lpfc_els_rcv_rnid(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
5289 IOCB_t *icmd; 5282 IOCB_t *icmd;
5290 RNID *rn; 5283 RNID *rn;
5291 struct ls_rjt stat; 5284 struct ls_rjt stat;
5292 uint32_t cmd, did; 5285 uint32_t cmd;
5293 5286
5294 icmd = &cmdiocb->iocb; 5287 icmd = &cmdiocb->iocb;
5295 did = icmd->un.elsreq64.remoteID;
5296 pcmd = (struct lpfc_dmabuf *) cmdiocb->context2; 5288 pcmd = (struct lpfc_dmabuf *) cmdiocb->context2;
5297 lp = (uint32_t *) pcmd->virt; 5289 lp = (uint32_t *) pcmd->virt;
5298 5290
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 310507dede2a..5452f1f4220e 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -5031,7 +5031,6 @@ lpfc_disc_start(struct lpfc_vport *vport)
5031 struct lpfc_hba *phba = vport->phba; 5031 struct lpfc_hba *phba = vport->phba;
5032 uint32_t num_sent; 5032 uint32_t num_sent;
5033 uint32_t clear_la_pending; 5033 uint32_t clear_la_pending;
5034 int did_changed;
5035 5034
5036 if (!lpfc_is_link_up(phba)) { 5035 if (!lpfc_is_link_up(phba)) {
5037 lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, 5036 lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI,
@@ -5050,11 +5049,6 @@ lpfc_disc_start(struct lpfc_vport *vport)
5050 5049
5051 lpfc_set_disctmo(vport); 5050 lpfc_set_disctmo(vport);
5052 5051
5053 if (vport->fc_prevDID == vport->fc_myDID)
5054 did_changed = 0;
5055 else
5056 did_changed = 1;
5057
5058 vport->fc_prevDID = vport->fc_myDID; 5052 vport->fc_prevDID = vport->fc_myDID;
5059 vport->num_disc_nodes = 0; 5053 vport->num_disc_nodes = 0;
5060 5054
@@ -6343,7 +6337,7 @@ lpfc_parse_fcoe_conf(struct lpfc_hba *phba,
6343 uint8_t *buff, 6337 uint8_t *buff,
6344 uint32_t size) 6338 uint32_t size)
6345{ 6339{
6346 uint32_t offset = 0, rec_length; 6340 uint32_t offset = 0;
6347 uint8_t *rec_ptr; 6341 uint8_t *rec_ptr;
6348 6342
6349 /* 6343 /*
@@ -6370,8 +6364,6 @@ lpfc_parse_fcoe_conf(struct lpfc_hba *phba,
6370 } 6364 }
6371 offset += 4; 6365 offset += 4;
6372 6366
6373 rec_length = buff[offset + 1];
6374
6375 /* Read FCoE param record */ 6367 /* Read FCoE param record */
6376 rec_ptr = lpfc_get_rec_conf23(&buff[offset], 6368 rec_ptr = lpfc_get_rec_conf23(&buff[offset],
6377 size - offset, FCOE_PARAM_TYPE); 6369 size - offset, FCOE_PARAM_TYPE);
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 0d9230486d6e..0b2c53af85c7 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -6719,7 +6719,6 @@ lpfc_sli4_read_config(struct lpfc_hba *phba)
6719 struct lpfc_mbx_get_func_cfg *get_func_cfg; 6719 struct lpfc_mbx_get_func_cfg *get_func_cfg;
6720 struct lpfc_rsrc_desc_fcfcoe *desc; 6720 struct lpfc_rsrc_desc_fcfcoe *desc;
6721 char *pdesc_0; 6721 char *pdesc_0;
6722 uint32_t desc_count;
6723 int length, i, rc = 0, rc2; 6722 int length, i, rc = 0, rc2;
6724 6723
6725 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 6724 pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
@@ -6850,7 +6849,6 @@ lpfc_sli4_read_config(struct lpfc_hba *phba)
6850 6849
6851 /* search for fc_fcoe resrouce descriptor */ 6850 /* search for fc_fcoe resrouce descriptor */
6852 get_func_cfg = &pmb->u.mqe.un.get_func_cfg; 6851 get_func_cfg = &pmb->u.mqe.un.get_func_cfg;
6853 desc_count = get_func_cfg->func_cfg.rsrc_desc_count;
6854 6852
6855 pdesc_0 = (char *)&get_func_cfg->func_cfg.desc[0]; 6853 pdesc_0 = (char *)&get_func_cfg->func_cfg.desc[0];
6856 desc = (struct lpfc_rsrc_desc_fcfcoe *)pdesc_0; 6854 desc = (struct lpfc_rsrc_desc_fcfcoe *)pdesc_0;
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 2c7057fa2adb..cea89c6ce1d6 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -187,7 +187,6 @@ lpfc_sli4_mq_put(struct lpfc_queue *q, struct lpfc_mqe *mqe)
187{ 187{
188 struct lpfc_mqe *temp_mqe; 188 struct lpfc_mqe *temp_mqe;
189 struct lpfc_register doorbell; 189 struct lpfc_register doorbell;
190 uint32_t host_index;
191 190
192 /* sanity check on queue memory */ 191 /* sanity check on queue memory */
193 if (unlikely(!q)) 192 if (unlikely(!q))
@@ -202,7 +201,6 @@ lpfc_sli4_mq_put(struct lpfc_queue *q, struct lpfc_mqe *mqe)
202 q->phba->mbox = (MAILBOX_t *)temp_mqe; 201 q->phba->mbox = (MAILBOX_t *)temp_mqe;
203 202
204 /* Update the host index before invoking device */ 203 /* Update the host index before invoking device */
205 host_index = q->host_index;
206 q->host_index = ((q->host_index + 1) % q->entry_count); 204 q->host_index = ((q->host_index + 1) % q->entry_count);
207 205
208 /* Ring Doorbell */ 206 /* Ring Doorbell */
@@ -2435,11 +2433,9 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
2435 IOCB_t * irsp; 2433 IOCB_t * irsp;
2436 WORD5 * w5p; 2434 WORD5 * w5p;
2437 uint32_t Rctl, Type; 2435 uint32_t Rctl, Type;
2438 uint32_t match;
2439 struct lpfc_iocbq *iocbq; 2436 struct lpfc_iocbq *iocbq;
2440 struct lpfc_dmabuf *dmzbuf; 2437 struct lpfc_dmabuf *dmzbuf;
2441 2438
2442 match = 0;
2443 irsp = &(saveq->iocb); 2439 irsp = &(saveq->iocb);
2444 2440
2445 if (irsp->ulpCommand == CMD_ASYNC_STATUS) { 2441 if (irsp->ulpCommand == CMD_ASYNC_STATUS) {
@@ -2865,7 +2861,7 @@ lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
2865void lpfc_poll_eratt(unsigned long ptr) 2861void lpfc_poll_eratt(unsigned long ptr)
2866{ 2862{
2867 struct lpfc_hba *phba; 2863 struct lpfc_hba *phba;
2868 uint32_t eratt = 0, rem; 2864 uint32_t eratt = 0;
2869 uint64_t sli_intr, cnt; 2865 uint64_t sli_intr, cnt;
2870 2866
2871 phba = (struct lpfc_hba *)ptr; 2867 phba = (struct lpfc_hba *)ptr;
@@ -2880,7 +2876,7 @@ void lpfc_poll_eratt(unsigned long ptr)
2880 cnt = (sli_intr - phba->sli.slistat.sli_prev_intr); 2876 cnt = (sli_intr - phba->sli.slistat.sli_prev_intr);
2881 2877
2882 /* 64-bit integer division not supporte on 32-bit x86 - use do_div */ 2878 /* 64-bit integer division not supporte on 32-bit x86 - use do_div */
2883 rem = do_div(cnt, LPFC_ERATT_POLL_INTERVAL); 2879 do_div(cnt, LPFC_ERATT_POLL_INTERVAL);
2884 phba->sli.slistat.sli_ips = cnt; 2880 phba->sli.slistat.sli_ips = cnt;
2885 2881
2886 phba->sli.slistat.sli_prev_intr = sli_intr; 2882 phba->sli.slistat.sli_prev_intr = sli_intr;
@@ -5953,9 +5949,6 @@ lpfc_sli4_get_allocated_extnts(struct lpfc_hba *phba, uint16_t type,
5953 curr_blks++; 5949 curr_blks++;
5954 } 5950 }
5955 5951
5956 /* Calculate the total requested length of the dma memory. */
5957 req_len = curr_blks * sizeof(uint16_t);
5958
5959 /* 5952 /*
5960 * Calculate the size of an embedded mailbox. The uint32_t 5953 * Calculate the size of an embedded mailbox. The uint32_t
5961 * accounts for extents-specific word. 5954 * accounts for extents-specific word.
@@ -6766,13 +6759,16 @@ void
6766lpfc_mbox_timeout_handler(struct lpfc_hba *phba) 6759lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
6767{ 6760{
6768 LPFC_MBOXQ_t *pmbox = phba->sli.mbox_active; 6761 LPFC_MBOXQ_t *pmbox = phba->sli.mbox_active;
6769 MAILBOX_t *mb = &pmbox->u.mb; 6762 MAILBOX_t *mb = NULL;
6763
6770 struct lpfc_sli *psli = &phba->sli; 6764 struct lpfc_sli *psli = &phba->sli;
6771 6765
6772 /* If the mailbox completed, process the completion and return */ 6766 /* If the mailbox completed, process the completion and return */
6773 if (lpfc_sli4_process_missed_mbox_completions(phba)) 6767 if (lpfc_sli4_process_missed_mbox_completions(phba))
6774 return; 6768 return;
6775 6769
6770 if (pmbox != NULL)
6771 mb = &pmbox->u.mb;
6776 /* Check the pmbox pointer first. There is a race condition 6772 /* Check the pmbox pointer first. There is a race condition
6777 * between the mbox timeout handler getting executed in the 6773 * between the mbox timeout handler getting executed in the
6778 * worklist and the mailbox actually completing. When this 6774 * worklist and the mailbox actually completing. When this
@@ -8121,7 +8117,6 @@ lpfc_sli4_scmd_to_wqidx_distr(struct lpfc_hba *phba)
8121 cpup += cpu; 8117 cpup += cpu;
8122 return cpup->channel_id; 8118 return cpup->channel_id;
8123 } 8119 }
8124 chann = cpu;
8125 } 8120 }
8126 chann = atomic_add_return(1, &phba->fcp_qidx); 8121 chann = atomic_add_return(1, &phba->fcp_qidx);
8127 chann = (chann % phba->cfg_fcp_io_channel); 8122 chann = (chann % phba->cfg_fcp_io_channel);
@@ -12604,6 +12599,9 @@ lpfc_sli4_hba_intr_handler(int irq, void *dev_id)
12604 * Process all the event on FCP fast-path EQ 12599 * Process all the event on FCP fast-path EQ
12605 */ 12600 */
12606 while ((eqe = lpfc_sli4_eq_get(fpeq))) { 12601 while ((eqe = lpfc_sli4_eq_get(fpeq))) {
12602 if (eqe == NULL)
12603 break;
12604
12607 lpfc_sli4_hba_handle_eqe(phba, eqe, fcp_eqidx); 12605 lpfc_sli4_hba_handle_eqe(phba, eqe, fcp_eqidx);
12608 if (!(++ecount % fpeq->entry_repost)) 12606 if (!(++ecount % fpeq->entry_repost))
12609 lpfc_sli4_eq_release(fpeq, LPFC_QUEUE_NOARM); 12607 lpfc_sli4_eq_release(fpeq, LPFC_QUEUE_NOARM);
@@ -14244,7 +14242,6 @@ lpfc_sli4_post_sgl(struct lpfc_hba *phba,
14244 "2511 POST_SGL mailbox failed with " 14242 "2511 POST_SGL mailbox failed with "
14245 "status x%x add_status x%x, mbx status x%x\n", 14243 "status x%x add_status x%x, mbx status x%x\n",
14246 shdr_status, shdr_add_status, rc); 14244 shdr_status, shdr_add_status, rc);
14247 rc = -ENXIO;
14248 } 14245 }
14249 return 0; 14246 return 0;
14250} 14247}