From patchwork Mon Feb 19 19:13:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 128839 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3800670ljc; Mon, 19 Feb 2018 10:22:27 -0800 (PST) X-Google-Smtp-Source: AH8x225J1unemXSazR4mpW4P2S50aGxADcL3cgHTPBAHDwXEbcnh0Zvz3Q7cxam0EYQY++mhDlRT X-Received: by 10.101.96.212 with SMTP id r20mr12978156pgv.139.1519064547840; Mon, 19 Feb 2018 10:22:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519064547; cv=none; d=google.com; s=arc-20160816; b=Urzpyv8WXWK9MsqZaxEICHPMkv4EFHl5wF70LlH+SQTQFrUmX6Xz+CgFycJj4pbdSe lCls29KWO0yhDE33KE1zdDLfvUPtcSQ3jmM7JGiE1xUGLSUqqZtsc+6nxHA9SzkojuY4 y09a0MlaGBVZquzi2hAXy+86Cz41XMv+QU8brW2lq9A8P0azdSmFnFuIZ1XkIYDwU0j7 GGYGGNEDxLLpZUl4FOS7IPkCVQK/QJZDBdVJJb9VRvNyrn7WdfHN+Joku/ReBkNMgMZq JoJeYONgkjcUDRPzhBaODq9Xw9ikwiI56jaPAirSElHasbRBbQUmmXjGp5jKzFLC23NB sa3w== 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=ZP5SZxqFQdJne0lWH4cupgrkQqourqCLnVew+WnTtoLir6/Qh71o3GMUMjY2rtKa4E wDAA8IeHqF+TPHed/GqVzQF1PjUlmcgzor4p0s6G8h8i8UF11vC6UZUCSL8y8un1Dz6s W7rpfCOqFWOX3ktDQ90Ab8eKB6sMfK2jbrfQA4VhEE/i4+EvP6Iy9B/JYeuVYXXYFeDG H27B3fuWttCe9q/npaI7+91kDgabJyUqIg9+n0np04vKIOPFAL1aNTkMRCLCIgihAajq XC0v6MvcwrL8/Mu1HS4yrPL8V2GVdA0NGqIP09hydMd12L3nsSGcoBhVxWH/j5pL4W3T 2p5w== 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 i2si69512pgo.550.2018.02.19.10.22.27; Mon, 19 Feb 2018 10:22:27 -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 S1753598AbeBSSWX (ORCPT + 28 others); Mon, 19 Feb 2018 13:22:23 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:5250 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753430AbeBSSWP (ORCPT ); Mon, 19 Feb 2018 13:22:15 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id EF764C857F287; Tue, 20 Feb 2018 02:21:59 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.361.1; Tue, 20 Feb 2018 02:21:54 +0800 From: John Garry To: , , , CC: , , , , Xiaofei Tan , John Garry Subject: [PATCH 7/8] scsi: hisi_sas: fix return value of hisi_sas_task_prep() Date: Tue, 20 Feb 2018 03:13:30 +0800 Message-ID: <1519067611-206638-8-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1519067611-206638-1-git-send-email-john.garry@huawei.com> References: <1519067611-206638-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)) {