From patchwork Mon May 21 10:09:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 136442 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp119938lji; Mon, 21 May 2018 03:12:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrWu8wIK0616kLa6mlRJzgSssseNZiqzfpuG/vUpQFmo4bdTM25mL65XP6mIegolqT63LFg X-Received: by 2002:a62:a111:: with SMTP id b17-v6mr19508540pff.132.1526897559604; Mon, 21 May 2018 03:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526897559; cv=none; d=google.com; s=arc-20160816; b=InoRjlMvxGnuvuaNxARfhIvu0RJsdVPqC4CL5sekJRRnKXTgUTmV6nIGj4CIUbt/0E eIGapRXjZiM72aG728oNAP/SV/X6ljI/o4gyPqbLGuntIpE+hhOxOR82uj2vhGvHuAcw 3RWUUNkWHAFN2FqpX1CfZ/9I3ifypr3opOCDMJRlwmZxTQG7xBfjwro3T8rzf8N/aqlV WTRGoF7vAJGOa2i+jRFXaMzjfwfBsDDbMEm8ReCLF58PDNhxMU6of0z/JvDF5EMbKzsC Z8vOR71mFh3HhHQieCawFRyLP6snytXHBZD9fuzSbosouRMtKwpwfRGuEs1sGHD1CdAK /vvw== 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=y0HPNPs1T9LOgceGy4FSz7DUKurIdpRApbaNic11mRo=; b=VL7xvg8r8CgWXdgQErUlxD+LUWiPstUCqdivzcuPWbBeMQwm5y5ft4ji0qOv24OUP6 z6f7pLhOCUgI6hZ2HXp4G9MQd0FReT8pCfh+fhxS0ca++1Kxbh5OYvQ0MK6lwraYcozf VQzV28FP4E3HtdzRM0zdHkey+FVnXzhl6bPa1JmStRTeydcErqHwixk2jJ97Gp461vwy bEI7cVyI2oDeA0TgOIfZ+MzbH52OmTOZfR2ExvdqyGZLZuAqvH8SLKgNRzXr3SXWLMpt /kdvijoJm6Ws6lpd+tVr902pq/yJE6tDfhTJ9xIvJnO69K+x3ysyz2MydjGkQA2zlan9 LmQw== 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 y25-v6si13208919pfn.248.2018.05.21.03.12.39; Mon, 21 May 2018 03:12:39 -0700 (PDT) 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 S1752791AbeEUKMh (ORCPT + 29 others); Mon, 21 May 2018 06:12:37 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:55810 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752645AbeEUKLp (ORCPT ); Mon, 21 May 2018 06:11:45 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 78CA71225CCA1; Mon, 21 May 2018 18:11:40 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.382.0; Mon, 21 May 2018 18:11:33 +0800 From: John Garry To: , CC: , , , Xiaofei Tan , "John Garry" Subject: [PATCH 12/13] scsi: hisi_sas: Fix return value when get_free_slot() failed Date: Mon, 21 May 2018 18:09:24 +0800 Message-ID: <1526897365-228549-13-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1526897365-228549-1-git-send-email-john.garry@huawei.com> References: <1526897365-228549-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 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 Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 ++ 1 file changed, 2 insertions(+) -- 1.9.1 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);