diff mbox series

[08/10] crypto/virtio: fix return values check error

Message ID 1618839289-33224-9-git-send-email-humin29@huawei.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers show
Series fixes for clean code | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Min Hu (Connor) April 19, 2021, 1:34 p.m. UTC
From: HongBo Zheng <zhenghongbo3@huawei.com>

In virtio_crypto_pkt_tx_burst, we check the return values of
virtqueue_crypto_enqueue_xmit, which may returns -ENOSPC/-EMSGSIZE,
but we only check ENOSPC/EMSGSIZE, and cause the result of checks
is always false.

This patch fix this problem.

Fixes: 82adb12a1fce ("crypto/virtio: support burst enqueue/dequeue")
Cc: stable@dpdk.org

Signed-off-by: HongBo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/crypto/virtio/virtio_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c
index e1cb4ad..a35a5b0 100644
--- a/drivers/crypto/virtio/virtio_rxtx.c
+++ b/drivers/crypto/virtio/virtio_rxtx.c
@@ -500,10 +500,10 @@  virtio_crypto_pkt_tx_burst(void *tx_queue, struct rte_crypto_op **tx_pkts,
 		/* Enqueue Packet buffers */
 		error = virtqueue_crypto_enqueue_xmit(txvq, tx_pkts[nb_tx]);
 		if (unlikely(error)) {
-			if (error == ENOSPC)
+			if (error == -ENOSPC)
 				VIRTIO_CRYPTO_TX_LOG_ERR(
 					"virtqueue_enqueue Free count = 0");
-			else if (error == EMSGSIZE)
+			else if (error == -EMSGSIZE)
 				VIRTIO_CRYPTO_TX_LOG_ERR(
 					"virtqueue_enqueue Free count < 1");
 			else