Commit 3235a201 authored by Xingui Yang's avatar Xingui Yang Committed by Zhou Juan
Browse files

scsi: hisi_sas: Move slot variable definition in hisi_sas_abort_task()

mainline inclusion
from mainline-v6.2-rc1
commit 4b329abc
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6NPLN
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4b329abc91800d23941ac773e69b322a13981ecb



----------------------------------------------------------------------

Each branch currently defines a slot variable independently, and it is
neater to move it to the function head.

Signed-off-by: default avatarXingui Yang <yangxingui@huawei.com>
Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
Link: https://lore.kernel.org/r/1665998435-199946-3-git-send-email-john.garry@huawei.com


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarxiabing <xiabing12@h-partners.com>
parent 188c3a64
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -1680,6 +1680,7 @@ static int hisi_sas_abort_task(struct sas_task *task)
	struct hisi_sas_tmf_task tmf_task;
	struct domain_device *device = task->dev;
	struct hisi_sas_device *sas_dev = device->lldd_dev;
	struct hisi_sas_slot *slot = task->lldd_task;
	struct hisi_hba *hisi_hba;
	struct device *dev;
	int rc = TMF_RESP_FUNC_FAILED;
@@ -1693,7 +1694,6 @@ static int hisi_sas_abort_task(struct sas_task *task)

	spin_lock_irqsave(&task->task_state_lock, flags);
	if (task->task_state_flags & SAS_TASK_STATE_DONE) {
		struct hisi_sas_slot *slot = task->lldd_task;
		struct hisi_sas_cq *cq;

		if (slot) {
@@ -1711,9 +1711,8 @@ static int hisi_sas_abort_task(struct sas_task *task)
	task->task_state_flags |= SAS_TASK_STATE_ABORTED;
	spin_unlock_irqrestore(&task->task_state_lock, flags);

	if (task->lldd_task && task->task_proto & SAS_PROTOCOL_SSP) {
	if (slot && task->task_proto & SAS_PROTOCOL_SSP) {
		struct scsi_cmnd *cmnd = task->uldd_task;
		struct hisi_sas_slot *slot = task->lldd_task;
		u16 tag = slot->idx;
		int rc2;

@@ -1756,9 +1755,8 @@ static int hisi_sas_abort_task(struct sas_task *task)
			hisi_sas_dereg_device(hisi_hba, device);
			rc = hisi_sas_softreset_ata_disk(device);
		}
	} else if (task->lldd_task && task->task_proto & SAS_PROTOCOL_SMP) {
	} else if (slot && task->task_proto & SAS_PROTOCOL_SMP) {
		/* SMP */
		struct hisi_sas_slot *slot = task->lldd_task;
		u32 tag = slot->idx;
		struct hisi_sas_cq *cq = &hisi_hba->cq[slot->dlvry_queue];