From patchwork Fri Mar 2 15:06:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 130545 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1375153lja; Fri, 2 Mar 2018 07:08:02 -0800 (PST) X-Google-Smtp-Source: AG47ELuHrsrkkmOBtJfxT3nFDr+DNW7HY/i6gwFLvoHZgsFWbRK2JImScwN2P8gx4qkSaY//nv5d X-Received: by 10.98.172.18 with SMTP id v18mr5967192pfe.175.1520003282247; Fri, 02 Mar 2018 07:08:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520003282; cv=none; d=google.com; s=arc-20160816; b=c0piAiiUeGakxui5Db5Tc5gvccwNnFzqxmWTMbubWtYbgRYPFzmWgTRi57nQdWTgA/ aNEA1zJw/PeqSNjiZDSCRMKMXNh74CXMpPpANY8dOi2FALoD9/s85fJeX8MU2TrFSf0N 9uhfhuH1SRtvok4XtQAWAdOgUG3U4CYKDOs/Ism5nrvlaKHjXcohqfQDmf6bszpwbfDH OldX/1vgTtwXgq0UodUAX34RMVWRaWeCd9n60ga5V+rqRt9E5k/lnAJirsF2oRwabggX dymxD6idnvBXonP1uqFSt2RAcJqYlvRxSUT/FzFSPd5c1GENpdLgDf7Gld4/9Qx/1Q46 ciTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=0mADjAhD8vNirl2KxJinAGhfM0hmPNYd14t60Q+9Kpk=; b=u2CkqA40UIEigR76HOCrIz7edaHweCPCttveySbB8Zp5Noam/9/Wl21Ram42fIyk8r zga46oGZAe2V0Bwy37EFaFn4vBt4yXn7dRdD4ztvAtYdKiZ9KxcY31aMEo4uiGWbbrS9 +wlUXD6c8IsYwRKiHpIwgJY40MevKJreL/p9VNGNw7pRBNBv2YvzN/BqtB8EcSm7v6+2 UtVc5ZhCFn6i5t7rKOFY56Jk6PgGdn6oa4fblFlNBIFP25JTjASKbtOpefxygq/oBR42 OpW/3v5oG8eqywsPhBBBbs0QE7zkfcCHDNikZNWbYEgT5gMgabNsuwhh9G6WNiDzIEs4 w3JA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i7-v6si5107942plk.139.2018.03.02.07.08.01; Fri, 02 Mar 2018 07:08:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1429054AbeCBPH5 (ORCPT + 28 others); Fri, 2 Mar 2018 10:07:57 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:5729 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1429002AbeCBPHu (ORCPT ); Fri, 2 Mar 2018 10:07:50 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 1AB24436D8FAF; Fri, 2 Mar 2018 23:07:33 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.361.1; Fri, 2 Mar 2018 23:07:29 +0800 From: John Garry To: , , , CC: , , , , Xiaofei Tan , John Garry 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 Message-ID: <1520003182-26277-8-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520003182-26277-1-git-send-email-john.garry@huawei.com> References: <1520003182-26277-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaofei Tan 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 Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 1.9.1 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)) {