diff mbox

[V3,5/9] pm80xx : cleanup in pm8001_abort_task function.

Message ID 20170919171004.10331-6-Viswas.G@microsemi.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Viswas G Sept. 19, 2017, 5:10 p.m. UTC
Signed-off-by: Deepak Ukey <deepak.ukey@microsemi.com>
Signed-off-by: Viswas G <Viswas.G@microsemi.com>

Acked-by: Jack Wang <jinpu.wang@profitbricks.com>
---
 drivers/scsi/pm8001/pm8001_sas.c | 49 +++++++++++-----------------------------
 1 file changed, 13 insertions(+), 36 deletions(-)

Comments

kernel test robot Sept. 20, 2017, 3:57 p.m. UTC | #1
Hi Viswas,

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v4.14-rc1 next-20170920]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Viswas-G/pm80xx-updates/20170920-202506
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-a0-09202136 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/scsi/pm8001/pm8001_sas.c: In function 'pm8001_abort_task':
   drivers/scsi/pm8001/pm8001_sas.c:1206: warning: label 'out' defined but not used
>> drivers/scsi/pm8001/pm8001_sas.c:1166: warning: unused variable 'ccb'

vim +/ccb +1166 drivers/scsi/pm8001/pm8001_sas.c

dbf9bfe61 jack wang 2009-10-14  1157  
dbf9bfe61 jack wang 2009-10-14  1158  /*  mandatory SAM-3, still need free task/ccb info, abord the specified task */
dbf9bfe61 jack wang 2009-10-14  1159  int pm8001_abort_task(struct sas_task *task)
dbf9bfe61 jack wang 2009-10-14  1160  {
dbf9bfe61 jack wang 2009-10-14  1161  	unsigned long flags;
a9d840710 Viswas G  2017-09-19  1162  	u32 tag;
dbf9bfe61 jack wang 2009-10-14  1163  	u32 device_id;
dbf9bfe61 jack wang 2009-10-14  1164  	struct domain_device *dev ;
a9d840710 Viswas G  2017-09-19  1165  	struct pm8001_hba_info *pm8001_ha;
dbf9bfe61 jack wang 2009-10-14 @1166  	struct pm8001_ccb_info *ccb;
dbf9bfe61 jack wang 2009-10-14  1167  	struct scsi_lun lun;
dbf9bfe61 jack wang 2009-10-14  1168  	struct pm8001_device *pm8001_dev;
dbf9bfe61 jack wang 2009-10-14  1169  	struct pm8001_tmf_task tmf_task;
dbf9bfe61 jack wang 2009-10-14  1170  	int rc = TMF_RESP_FUNC_FAILED;
dbf9bfe61 jack wang 2009-10-14  1171  	if (unlikely(!task || !task->lldd_task || !task->dev))
a9d840710 Viswas G  2017-09-19  1172  		return TMF_RESP_FUNC_FAILED;
a9d840710 Viswas G  2017-09-19  1173  	dev = task->dev;
a9d840710 Viswas G  2017-09-19  1174  	pm8001_dev = dev->lldd_dev;
a9d840710 Viswas G  2017-09-19  1175  	pm8001_ha = pm8001_find_ha_by_dev(dev);
a9d840710 Viswas G  2017-09-19  1176  	device_id = pm8001_dev->device_id;
a9d840710 Viswas G  2017-09-19  1177  	rc = pm8001_find_tag(task, &tag);
a9d840710 Viswas G  2017-09-19  1178  	if (rc == 0) {
a9d840710 Viswas G  2017-09-19  1179  		pm8001_printk("no tag for task:%p\n", task);
a9d840710 Viswas G  2017-09-19  1180  		return TMF_RESP_FUNC_FAILED;
a9d840710 Viswas G  2017-09-19  1181  	}
dbf9bfe61 jack wang 2009-10-14  1182  	spin_lock_irqsave(&task->task_state_lock, flags);
dbf9bfe61 jack wang 2009-10-14  1183  	if (task->task_state_flags & SAS_TASK_STATE_DONE) {
dbf9bfe61 jack wang 2009-10-14  1184  		spin_unlock_irqrestore(&task->task_state_lock, flags);
a9d840710 Viswas G  2017-09-19  1185  		return TMF_RESP_FUNC_COMPLETE;
dbf9bfe61 jack wang 2009-10-14  1186  	}
dbf9bfe61 jack wang 2009-10-14  1187  	spin_unlock_irqrestore(&task->task_state_lock, flags);
dbf9bfe61 jack wang 2009-10-14  1188  	if (task->task_proto & SAS_PROTOCOL_SSP) {
dbf9bfe61 jack wang 2009-10-14  1189  		struct scsi_cmnd *cmnd = task->uldd_task;
dbf9bfe61 jack wang 2009-10-14  1190  		int_to_scsilun(cmnd->device->lun, &lun);
dbf9bfe61 jack wang 2009-10-14  1191  		tmf_task.tmf = TMF_ABORT_TASK;
dbf9bfe61 jack wang 2009-10-14  1192  		tmf_task.tag_of_task_to_be_managed = tag;
dbf9bfe61 jack wang 2009-10-14  1193  		rc = pm8001_issue_ssp_tmf(dev, lun.scsi_lun, &tmf_task);
97ee20886 jack_wang 2009-11-05  1194  		pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev,
dbf9bfe61 jack wang 2009-10-14  1195  			pm8001_dev->sas_device, 0, tag);
dbf9bfe61 jack wang 2009-10-14  1196  	} else if (task->task_proto & SAS_PROTOCOL_SATA ||
dbf9bfe61 jack wang 2009-10-14  1197  		task->task_proto & SAS_PROTOCOL_STP) {
dbf9bfe61 jack wang 2009-10-14  1198  		rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev,
dbf9bfe61 jack wang 2009-10-14  1199  			pm8001_dev->sas_device, 0, tag);
dbf9bfe61 jack wang 2009-10-14  1200  	} else if (task->task_proto & SAS_PROTOCOL_SMP) {
dbf9bfe61 jack wang 2009-10-14  1201  		/* SMP */
dbf9bfe61 jack wang 2009-10-14  1202  		rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev,
dbf9bfe61 jack wang 2009-10-14  1203  			pm8001_dev->sas_device, 0, tag);
dbf9bfe61 jack wang 2009-10-14  1204  
dbf9bfe61 jack wang 2009-10-14  1205  	}
dbf9bfe61 jack wang 2009-10-14 @1206  out:
dbf9bfe61 jack wang 2009-10-14  1207  	if (rc != TMF_RESP_FUNC_COMPLETE)
dbf9bfe61 jack wang 2009-10-14  1208  		pm8001_printk("rc= %d\n", rc);
dbf9bfe61 jack wang 2009-10-14  1209  	return rc;
dbf9bfe61 jack wang 2009-10-14  1210  }
dbf9bfe61 jack wang 2009-10-14  1211  

:::::: The code at line 1166 was first introduced by commit
:::::: dbf9bfe615717d1145f263c0049fe2328e6ed395 [SCSI] pm8001: add SAS/SATA HBA driver

:::::: TO: jack wang <jack_wang@usish.com>
:::::: CC: James Bottomley <James.Bottomley@suse.de>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index ce584c31d36e..e80b0542a67f 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -1159,40 +1159,35 @@  int pm8001_query_task(struct sas_task *task)
 int pm8001_abort_task(struct sas_task *task)
 {
 	unsigned long flags;
-	u32 tag = 0xdeadbeef;
+	u32 tag;
 	u32 device_id;
 	struct domain_device *dev ;
-	struct pm8001_hba_info *pm8001_ha = NULL;
+	struct pm8001_hba_info *pm8001_ha;
 	struct pm8001_ccb_info *ccb;
 	struct scsi_lun lun;
 	struct pm8001_device *pm8001_dev;
 	struct pm8001_tmf_task tmf_task;
 	int rc = TMF_RESP_FUNC_FAILED;
 	if (unlikely(!task || !task->lldd_task || !task->dev))
-		return rc;
+		return TMF_RESP_FUNC_FAILED;
+	dev = task->dev;
+	pm8001_dev = dev->lldd_dev;
+	pm8001_ha = pm8001_find_ha_by_dev(dev);
+	device_id = pm8001_dev->device_id;
+	rc = pm8001_find_tag(task, &tag);
+	if (rc == 0) {
+		pm8001_printk("no tag for task:%p\n", task);
+		return TMF_RESP_FUNC_FAILED;
+	}
 	spin_lock_irqsave(&task->task_state_lock, flags);
 	if (task->task_state_flags & SAS_TASK_STATE_DONE) {
 		spin_unlock_irqrestore(&task->task_state_lock, flags);
-		rc = TMF_RESP_FUNC_COMPLETE;
-		goto out;
+		return TMF_RESP_FUNC_COMPLETE;
 	}
 	spin_unlock_irqrestore(&task->task_state_lock, flags);
 	if (task->task_proto & SAS_PROTOCOL_SSP) {
 		struct scsi_cmnd *cmnd = task->uldd_task;
-		dev = task->dev;
-		ccb = task->lldd_task;
-		pm8001_dev = dev->lldd_dev;
-		pm8001_ha = pm8001_find_ha_by_dev(dev);
 		int_to_scsilun(cmnd->device->lun, &lun);
-		rc = pm8001_find_tag(task, &tag);
-		if (rc == 0) {
-			printk(KERN_INFO "No such tag in %s\n", __func__);
-			rc = TMF_RESP_FUNC_FAILED;
-			return rc;
-		}
-		device_id = pm8001_dev->device_id;
-		PM8001_EH_DBG(pm8001_ha,
-			pm8001_printk("abort io to deviceid= %d\n", device_id));
 		tmf_task.tmf = TMF_ABORT_TASK;
 		tmf_task.tag_of_task_to_be_managed = tag;
 		rc = pm8001_issue_ssp_tmf(dev, lun.scsi_lun, &tmf_task);
@@ -1200,28 +1195,10 @@  int pm8001_abort_task(struct sas_task *task)
 			pm8001_dev->sas_device, 0, tag);
 	} else if (task->task_proto & SAS_PROTOCOL_SATA ||
 		task->task_proto & SAS_PROTOCOL_STP) {
-		dev = task->dev;
-		pm8001_dev = dev->lldd_dev;
-		pm8001_ha = pm8001_find_ha_by_dev(dev);
-		rc = pm8001_find_tag(task, &tag);
-		if (rc == 0) {
-			printk(KERN_INFO "No such tag in %s\n", __func__);
-			rc = TMF_RESP_FUNC_FAILED;
-			return rc;
-		}
 		rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev,
 			pm8001_dev->sas_device, 0, tag);
 	} else if (task->task_proto & SAS_PROTOCOL_SMP) {
 		/* SMP */
-		dev = task->dev;
-		pm8001_dev = dev->lldd_dev;
-		pm8001_ha = pm8001_find_ha_by_dev(dev);
-		rc = pm8001_find_tag(task, &tag);
-		if (rc == 0) {
-			printk(KERN_INFO "No such tag in %s\n", __func__);
-			rc = TMF_RESP_FUNC_FAILED;
-			return rc;
-		}
 		rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev,
 			pm8001_dev->sas_device, 0, tag);