Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp272565pxb; Mon, 8 Feb 2021 23:07:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwR3H/WMHiZopYaXW8UBiBABU/8S9v8QVLd35rQOxH2WxdS3iq6IH1Y9QsVn29U/5X90Fx/ X-Received: by 2002:a17:906:eb87:: with SMTP id mh7mr21547899ejb.10.1612854426939; Mon, 08 Feb 2021 23:07:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612854426; cv=none; d=google.com; s=arc-20160816; b=MP2hh/ArJxJHpHE+McVxdXukgmYkwZZeFyznxcSUbBDLoQ9wTLufW5fr5ohOLX5AiP 8Jc8fb+VHpS8De/Sc7yCUSqf92s+8SeX+d6Ix8mje7hZnX6fVSesrZzI80AruX2Xmjgy ObmnOnw6tNRItnVFPz7V1pWbWznFyJwDYc75yXIJqTC50ssdqc5v6Z23LTIJ8/BHFeiR LYIJDpAVEh8W/jn18S6LwyPhCQYtv4M7t1kYnLsPtcXaODujmSv3lPocUCH10MUU7vqM nMxf0ERvst1z2mvPDR1b0wHiznflfEMoG8chUvxL1enTWDiv01H/prj3NtgtkSPw0dt2 e9lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=y0PVPapBUEO7uq+38Fmo9ucEDeeFcH2mB9vsJl5UJck=; b=WJg2ZSshPouWJ+y2jDHv+AxBM8IoSCHJAFPt2Cb9xHrHlYvdn4CPcEIbtfUP+VT0C/ cemlL+wi+wfYzib7H5DHz4sQWwvRR8epoEGw55yHXCj3vVRZrar7eAuRgdQ2hwTdNiTP 1BB6tlP+98r0S5s9d698V9v5q4UKM9REeL1GV1ohtAy7wXECgBssOnwcsxYMT4uc9tqh g/yDxp1Y4DQyOOzmJZXceuSOBDyEi/BM9f6zrD8dV4k5dBAOIXGa7+vWpPR2D/3fvvVq cIEdfFr3kVGQcNbtsjQ9zPbYy884VFcTh00vNHnYXiup1bDIgGEw7rp6gjGaX+KIOQMt rzYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jj13si32136ejc.60.2021.02.08.23.06.33; Mon, 08 Feb 2021 23:07:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229725AbhBIHEo (ORCPT + 99 others); Tue, 9 Feb 2021 02:04:44 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:11716 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbhBIHEf (ORCPT ); Tue, 9 Feb 2021 02:04:35 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4DZYjT2Y9ZzlHsL; Tue, 9 Feb 2021 15:02:05 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Tue, 9 Feb 2021 15:03:31 +0800 From: chenxiang To: , , , , CC: , , , Xiang Chen Subject: [PATCH 3/4] crypto: ux500 - Fix the parameter of dma_unmap_sg() Date: Tue, 9 Feb 2021 14:59:24 +0800 Message-ID: <1612853965-67777-4-git-send-email-chenxiang66@hisilicon.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1612853965-67777-1-git-send-email-chenxiang66@hisilicon.com> References: <1612853965-67777-1-git-send-email-chenxiang66@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@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. So fix this usage. Signed-off-by: Xiang Chen --- drivers/crypto/ux500/cryp/cryp_core.c | 4 ++-- drivers/crypto/ux500/hash/hash_core.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c index c3adeb2..9abf00e 100644 --- a/drivers/crypto/ux500/cryp/cryp_core.c +++ b/drivers/crypto/ux500/cryp/cryp_core.c @@ -608,12 +608,12 @@ static void cryp_dma_done(struct cryp_ctx *ctx) chan = ctx->device->dma.chan_mem2cryp; dmaengine_terminate_all(chan); dma_unmap_sg(chan->device->dev, ctx->device->dma.sg_src, - ctx->device->dma.sg_src_len, DMA_TO_DEVICE); + ctx->device->dma.nents_src, DMA_TO_DEVICE); chan = ctx->device->dma.chan_cryp2mem; dmaengine_terminate_all(chan); dma_unmap_sg(chan->device->dev, ctx->device->dma.sg_dst, - ctx->device->dma.sg_dst_len, DMA_FROM_DEVICE); + ctx->device->dma.nents_dst, DMA_FROM_DEVICE); } static int cryp_dma_write(struct cryp_ctx *ctx, struct scatterlist *sg, diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index da284b0..67b1237 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c @@ -190,7 +190,7 @@ static void hash_dma_done(struct hash_ctx *ctx) chan = ctx->device->dma.chan_mem2hash; dmaengine_terminate_all(chan); dma_unmap_sg(chan->device->dev, ctx->device->dma.sg, - ctx->device->dma.sg_len, DMA_TO_DEVICE); + ctx->device->dma.nents, DMA_TO_DEVICE); } static int hash_dma_write(struct hash_ctx *ctx, -- 2.8.1