From: Jack Wang <jinpu.wang@ionos.com>
To: linux-kernel@vger.kernel.org
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org
Subject: [PATCH v1 08/19] crypto: sahara: Fix error check for dma_map_sg
Date: Fri, 19 Aug 2022 08:07:50 +0200 [thread overview]
Message-ID: <20220819060801.10443-9-jinpu.wang@ionos.com> (raw)
In-Reply-To: <20220819060801.10443-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
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
next prev parent reply other threads:[~2022-08-19 6:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220819060801.10443-1-jinpu.wang@ionos.com>
2022-08-19 6:07 ` [PATCH v1 07/19] crypto: gemin: Fix error check for dma_map_sg Jack Wang
2022-08-26 8:13 ` Linus Walleij
2022-08-26 11:06 ` Herbert Xu
2022-08-26 12:04 ` LABBE Corentin
2022-08-26 12:08 ` Jinpu Wang
2022-08-19 6:07 ` Jack Wang [this message]
2022-08-19 6:07 ` [PATCH v1 09/19] crypto: qce: Fix dma_map_sg error check Jack Wang
2022-08-19 6:07 ` [PATCH v1 10/19] crypto: amlogic: " Jack Wang
2022-08-26 12:46 ` LABBE Corentin
2022-08-19 6:07 ` [PATCH v1 11/19] crypto: allwinner: " Jack Wang
2022-08-19 6:07 ` [PATCH v1 12/19] crypto: ccree: " Jack Wang
2022-08-21 9:44 ` Gilad Ben-Yossef
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=20220819060801.10443-9-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