linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: <jejb@linux.vnet.ibm.com>, <martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>, <linuxarm@huawei.com>,
	<linux-kernel@vger.kernel.org>,
	Xiaofei Tan <tanxiaofei@huawei.com>,
	"John Garry" <john.garry@huawei.com>
Subject: [PATCH 12/13] scsi: hisi_sas: Fix return value when get_free_slot() failed
Date: Mon, 21 May 2018 18:09:24 +0800	[thread overview]
Message-ID: <1526897365-228549-13-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1526897365-228549-1-git-send-email-john.garry@huawei.com>

From: Xiaofei Tan <tanxiaofei@huawei.com>

It is an step of executing task to get free slot. If the step
fails, we will cleanup LLDD resources and should return failure
to upper layer or internal caller to abort task execution of this
time.

But in the current code, the caller of get_free_slot() doesn't
return failure when get_free_slot() failed. This patch is to fix
it.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 2e02539..f6c4eb6 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -443,6 +443,7 @@ static int hisi_sas_task_prep(struct sas_task *task,
 	wr_q_index = hisi_hba->hw->get_free_slot(hisi_hba, dq);
 	if (wr_q_index < 0) {
 		spin_unlock_irqrestore(&dq->lock, flags_dq);
+		rc = -EAGAIN;
 		goto err_out_buf;
 	}
 
@@ -1708,6 +1709,7 @@ static int hisi_sas_query_task(struct sas_task *task)
 	wr_q_index = hisi_hba->hw->get_free_slot(hisi_hba, dq);
 	if (wr_q_index < 0) {
 		spin_unlock_irqrestore(&dq->lock, flags_dq);
+		rc = -EAGAIN;
 		goto err_out_buf;
 	}
 	list_add_tail(&slot->delivery, &dq->list);
-- 
1.9.1

  parent reply	other threads:[~2018-05-21 10:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21 10:09 [PATCH 00/13] hisi_sas: Misc improvements, bugfixes, etc John Garry
2018-05-21 10:09 ` [PATCH 01/13] scsi: hisi_sas: Introduce hisi_sas_phy_set_linkrate() John Garry
2018-05-21 10:09 ` [PATCH 02/13] scsi: hisi_sas: change slot index allocation mode John Garry
2018-05-21 10:09 ` [PATCH 03/13] scsi: hisi_sas: Change common allocation mode of device id John Garry
2018-05-21 10:09 ` [PATCH 04/13] scsi: hisi_sas: Add LED feature for v3 hw John Garry
2018-05-21 10:09 ` [PATCH 05/13] scsi: hisi_sas: Reset disks when discovered John Garry
2018-05-21 10:09 ` [PATCH 06/13] scsi: hisi_sas: Create a scsi_host_template per HW module John Garry
2018-05-21 10:09 ` [PATCH 07/13] scsi: hisi_sas: Init disks after controller reset John Garry
2018-05-21 10:09 ` [PATCH 08/13] scsi: hisi_sas: Try wait commands before before " John Garry
2018-05-21 10:09 ` [PATCH 09/13] scsi: hisi_sas: Include TMF elements in struct hisi_sas_slot John Garry
2018-05-21 10:09 ` [PATCH 10/13] scsi: hisi_sas: Add v2 hw force PHY function for internal ATA command John Garry
2018-05-21 10:09 ` [PATCH 11/13] scsi: hisi_sas: Terminate STP reject quickly for v2 hw John Garry
2018-05-21 10:09 ` John Garry [this message]
2018-05-21 10:09 ` [PATCH 13/13] scsi: hisi_sas: Mark PHY as in reset for nexus reset John Garry
2018-05-29  2:47 ` [PATCH 00/13] hisi_sas: Misc improvements, bugfixes, etc Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1526897365-228549-13-git-send-email-john.garry@huawei.com \
    --to=john.garry@huawei.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=martin.petersen@oracle.com \
    --cc=tanxiaofei@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).