From patchwork Fri Dec 8 17:16:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 121195 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp863087qgn; Fri, 8 Dec 2017 08:31:10 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ6KfZd4rACnKH2lo0piTVGrtuur9UvCcREnT3jRK/K36tLAmH8NcC9WOIBMUPqnAU4gQIJ X-Received: by 10.99.106.138 with SMTP id f132mr30257996pgc.115.1512750670715; Fri, 08 Dec 2017 08:31:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512750670; cv=none; d=google.com; s=arc-20160816; b=LYAzIIE2Zv65G9t+0PJkv4RpF6t1IcVCAwniZFHgulplwzHTX8AaSgZeu0+Tp0Oj8x ZY7qYt9qdFcMfKcjwDmcd/aQro0FlNnuLKeX5v3eG32bUkWdhv1LpyU0pH80DQ+mDqEp wUMZKpoKjKFlr78pl5n/1z6LgK3yUGESby6sxHTURbPso8BiDfZgog5gWttSBeug4dnV UfHzSEkky8bMju3D9YKH8w2YWWiPLxKCxVTK/Fi2Ccyp4NT2GVX8XuBEBBae6mFGP6EN r8hlnmCCcV9pZnNKe20x7UItE1+2Rt6g4TF0nRvDBK8FF3Ow5FrOuAe0IiTrnyv5GFda iCQA== 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=XYcaai3jnf8a/TZj/iuF2pemPzYtvMMiTsQqZYWu3b8=; b=HUgsrzNPZvhKhkwhHyUNGHWhKUxa+ftT3cyboGSt7nDEcNZBrIO2WmZyxFtdRJ0rQm mLj8A2he7XqnhwxCq8ChBUhu+OeKt07RksKQmfDLzZ9L8vJgdnVkzg3Oa8SikpwqTGgG RHUmSYomYCm/XG2RxSBhskHG9SxxqDjDZAUkRLba7MaX+Br6cwd/1fMQB0JVQEZcq6wQ 47x3kBIbGE0Paxl/JYa6YbCSQLQn5EYO0bdM5VYLXGf7zFLdSnMIlU05Jg6lTC9eyo0r ds+2p+3snTvyPyOMMJo1tmYEURfnielinyWlaQCBM8hZT+RgvIaYAjngGjC0YO4bQ7cz 9QBg== 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 o6si2289947pls.300.2017.12.08.08.31.09; Fri, 08 Dec 2017 08:31:10 -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 S1754274AbdLHQbH (ORCPT + 18 others); Fri, 8 Dec 2017 11:31:07 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2226 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753025AbdLHQbD (ORCPT ); Fri, 8 Dec 2017 11:31:03 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A3E9443104F8F; Sat, 9 Dec 2017 00:30:44 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.361.1; Sat, 9 Dec 2017 00:30:36 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 02/19] scsi: hisi_sas: fix dma_unmap_sg() parameter Date: Sat, 9 Dec 2017 01:16:33 +0800 Message-ID: <1512753410-50924-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1512753410-50924-1-git-send-email-john.garry@huawei.com> References: <1512753410-50924-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: Xiang Chen For function dma_unmap_sg(), the parameter should be number of elements in the scatterlist prior to the mapping, not after the mapping. Fix this usage. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 359ec52..d842530 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -192,7 +192,8 @@ void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task, if (!sas_protocol_ata(task->task_proto)) if (slot->n_elem) - dma_unmap_sg(dev, task->scatter, slot->n_elem, + dma_unmap_sg(dev, task->scatter, + task->num_scatter, task->data_dir); if (sas_dev) @@ -431,7 +432,8 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_sas_dq dev_err(dev, "task prep: failed[%d]!\n", rc); if (!sas_protocol_ata(task->task_proto)) if (n_elem) - dma_unmap_sg(dev, task->scatter, n_elem, + dma_unmap_sg(dev, task->scatter, + task->num_scatter, task->data_dir); prep_out: return rc;