mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: <jejb@linux.vnet.ibm.com>, <martin.petersen@oracle.com>,
	<robh+dt@kernel.org>, <mark.rutland@arm.com>
Cc: <linux-scsi@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linuxarm@huawei.com>, <linux-kernel@vger.kernel.org>,
	Xiaofei Tan <tanxiaofei@huawei.com>,
	John Garry <john.garry@huawei.com>
Subject: [PATCH v2 7/8] scsi: hisi_sas: fix return value of hisi_sas_task_prep()
Date: Fri, 2 Mar 2018 23:06:21 +0800	[thread overview]
Message-ID: <1520003182-26277-8-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1520003182-26277-1-git-send-email-john.garry@huawei.com>

From: Xiaofei Tan <tanxiaofei@huawei.com>

It is an implicit regulation that error code that function returned
should be negative. But hisi_sas_task_prep() doesn't follow this.
This may cause problems in the upper layer code.

For example, in sas_expander.c of libsas, smp_execute_task_sg() may
return the number of bytes of underrun. It will be conflicted with
the scenaio lldd_execute_task() return an positive error code.

This patch change the return value from SAS_PHY_DOWN to -ECOMM in
hisi_sas_task_prep().

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 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 88ad8d4..dff9723 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -316,7 +316,7 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_sas_dq
 		 */
 		if (device->dev_type != SAS_SATA_DEV)
 			task->task_done(task);
-		return SAS_PHY_DOWN;
+		return -ECOMM;
 	}
 
 	if (DEV_IS_GONE(sas_dev)) {
@@ -327,7 +327,7 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_sas_dq
 			dev_info(dev, "task prep: device %016llx not ready\n",
 				 SAS_ADDR(device->sas_addr));
 
-		return SAS_PHY_DOWN;
+		return -ECOMM;
 	}
 
 	port = to_hisi_sas_port(sas_port);
@@ -337,7 +337,7 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_sas_dq
 			 "SATA/STP" : "SAS",
 			 device->port->id);
 
-		return SAS_PHY_DOWN;
+		return -ECOMM;
 	}
 
 	if (!sas_protocol_ata(task->task_proto)) {
-- 
1.9.1

  parent reply	other threads:[~2018-03-02 15:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-02 15:06 [PATCH v2 0/8] hisi_sas: support x6000 board and some misc changes John Garry
2018-03-02 15:06 ` [PATCH v2 1/8] dt-bindings: scsi: hisi_sas: add an property of signal attenuation John Garry
2018-03-02 15:57   ` Rob Herring
2018-03-02 16:10     ` John Garry
2018-03-05 14:05       ` Rob Herring
2018-03-02 15:06 ` [PATCH v2 2/8] scsi: hisi_sas: support the property of signal attenuation for v2 hw John Garry
2018-03-02 15:06 ` [PATCH v2 3/8] scsi: hisi_sas: fix the issue of link rate inconsistency John Garry
2018-03-02 15:06 ` [PATCH v2 4/8] scsi: hisi_sas: fix the issue of setting linkrate register John Garry
2018-03-02 15:06 ` [PATCH v2 5/8] scsi: hisi_sas: increase timer expire of internal abort task John Garry
2018-03-02 15:06 ` [PATCH v2 6/8] scsi: hisi_sas: remove unused variable hisi_sas_devices.running_req John Garry
2018-03-02 15:06 ` John Garry [this message]
2018-03-02 15:06 ` [PATCH v2 8/8] scsi: hisi_sas: Code cleanup and minor bug fixes John Garry

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=1520003182-26277-8-git-send-email-john.garry@huawei.com \
    --to=john.garry@huawei.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=martin.petersen@oracle.com \
    --cc=robh+dt@kernel.org \
    --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

all inboxes | Powered by JetHome®