mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jack Wang <jinpu.wang@ionos.com>
To: herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>, linux-kernel@vger.kernel.org
Subject: [PATCH 2/6] crypto: sahara: Fix error check for dma_map_sg
Date: Thu, 25 Aug 2022 09:24:17 +0200	[thread overview]
Message-ID: <20220825072421.29020-3-jinpu.wang@ionos.com> (raw)
In-Reply-To: <20220825072421.29020-1-jinpu.wang@ionos.com>

dma_map_sg return 0 on error, it returns the number of
DMA address segments mapped (this may be shorter
than <nents> passed in if some elements of the scatter/gather
list are physically or virtually adjacent and an IOMMU maps
them with a single entry).

Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Fixes: 5de8875281e1 ("crypto: sahara - Add driver for SAHARA2 accelerator.")
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
---
 drivers/crypto/sahara.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
index 457084b344c1..bb71aac30e2c 100644
--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -487,13 +487,13 @@ static int sahara_hw_descriptor_create(struct sahara_dev *dev)
 
 	ret = dma_map_sg(dev->device, dev->in_sg, dev->nb_in_sg,
 			 DMA_TO_DEVICE);
-	if (ret != dev->nb_in_sg) {
+	if (!ret) {
 		dev_err(dev->device, "couldn't map in sg\n");
 		goto unmap_in;
 	}
 	ret = dma_map_sg(dev->device, dev->out_sg, dev->nb_out_sg,
 			 DMA_FROM_DEVICE);
-	if (ret != dev->nb_out_sg) {
+	if (!ret) {
 		dev_err(dev->device, "couldn't map out sg\n");
 		goto unmap_out;
 	}
-- 
2.34.1


  parent reply	other threads:[~2022-08-25  7:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220825072421.29020-1-jinpu.wang@ionos.com>
2022-08-25  7:24 ` [PATCH 1/6] crypto: gemin: " Jack Wang
2022-09-02 10:13   ` Herbert Xu
2022-08-25  7:24 ` Jack Wang [this message]
2022-08-25  7:24 ` [PATCH 3/6] crypto: qce: Fix dma_map_sg error check Jack Wang
2022-08-25  7:24 ` [PATCH 4/6] crypto: amlogic: " Jack Wang
2022-08-25  7:24 ` [PATCH 5/6] crypto: allwinner: " Jack Wang
2022-08-25 20:36   ` Jernej Škrabec
2022-09-02 10:18   ` Herbert Xu
2022-08-25  7:24 ` [PATCH 6/6] crypto: ccree: " Jack Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220825072421.29020-3-jinpu.wang@ionos.com \
    --to=jinpu.wang@ionos.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®