diff mbox series

[1/2] drivers/qat: fix wrong return value for invalid service

Message ID 20210728161831.6807-2-arkadiuszx.kusztal@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers show
Series drivers/qat: fix handling of unsupported services | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Arek Kusztal July 28, 2021, 4:18 p.m. UTC
Fix invalid value that is returned when asymmetric crypto
or compression service is selected.

Fixes: 8f393c4ffdc1 ("common/qat: support GEN4 devices")

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
 drivers/compress/qat/qat_comp_pmd.c | 2 +-
 drivers/crypto/qat/qat_asym_pmd.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Fan Zhang July 29, 2021, 8:58 a.m. UTC | #1
> -----Original Message-----
> From: Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Sent: Wednesday, July 28, 2021 5:19 PM
> To: dev@dpdk.org
> Cc: gakhil@marvell.com; Trahe, Fiona <fiona.trahe@intel.com>; Zhang, Roy
> Fan <roy.fan.zhang@intel.com>; Kusztal, ArkadiuszX
> <arkadiuszx.kusztal@intel.com>
> Subject: [PATCH 1/2] drivers/qat: fix wrong return value for invalid service
> 
> Fix invalid value that is returned when asymmetric crypto
> or compression service is selected.
> 
> Fixes: 8f393c4ffdc1 ("common/qat: support GEN4 devices")
> 
> Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> ---
>  drivers/compress/qat/qat_comp_pmd.c | 2 +-
>  drivers/crypto/qat/qat_asym_pmd.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/compress/qat/qat_comp_pmd.c
> b/drivers/compress/qat/qat_comp_pmd.c
> index cfdcb6b3d1..92a2285b53 100644
> --- a/drivers/compress/qat/qat_comp_pmd.c
> +++ b/drivers/compress/qat/qat_comp_pmd.c
> @@ -713,7 +713,7 @@ qat_comp_dev_create(struct qat_pci_device
> *qat_pci_dev,
> 
>  	if (qat_pci_dev->qat_dev_gen == QAT_GEN4) {
>  		QAT_LOG(ERR, "Compression PMD not supported on QAT
> 4xxx");
> -		return 0;
> +		return -(EFAULT);
>  	}
>  	snprintf(name, RTE_COMPRESSDEV_NAME_MAX_LEN, "%s_%s",
>  			qat_pci_dev->name, "comp");
> diff --git a/drivers/crypto/qat/qat_asym_pmd.c
> b/drivers/crypto/qat/qat_asym_pmd.c
> index 56ccca36d1..d4680c3847 100644
> --- a/drivers/crypto/qat/qat_asym_pmd.c
> +++ b/drivers/crypto/qat/qat_asym_pmd.c
> @@ -253,7 +253,7 @@ qat_asym_dev_create(struct qat_pci_device
> *qat_pci_dev,
> 
>  	if (qat_pci_dev->qat_dev_gen == QAT_GEN4) {
>  		QAT_LOG(ERR, "Asymmetric crypto PMD not supported on
> QAT 4xxx");
> -		return 0;
> +		return -(EFAULT);
>  	}
>  	snprintf(name, RTE_CRYPTODEV_NAME_MAX_LEN, "%s_%s",
>  			qat_pci_dev->name, "asym");
> --
> 2.30.2

Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Akhil Goyal July 30, 2021, 7:18 p.m. UTC | #2
> Subject: [EXT] [PATCH 1/2] drivers/qat: fix wrong return value for invalid
> service
> 
Title changed as " drivers: fix return value for QAT PMDs "
Please check ./devtools/check-git-log.sh before sending patch.
 
> Fix invalid value that is returned when asymmetric crypto
> or compression service is selected.

Description is also updated. Please check.
> 
> Fixes: 8f393c4ffdc1 ("common/qat: support GEN4 devices")
> 
> Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> ---

Applied to dpdk-next-crypto

Braces across 'EFAULT' are not needed. I tried fixing it, but it is being
Used at many places. Please fix that in a separate patch.
Thomas Monjalon July 31, 2021, 9:29 a.m. UTC | #3
30/07/2021 21:18, Akhil Goyal:
> > Subject: [EXT] [PATCH 1/2] drivers/qat: fix wrong return value for invalid
> > service
> > 
> Title changed as " drivers: fix return value for QAT PMDs "
> Please check ./devtools/check-git-log.sh before sending patch.
>  
> > Fix invalid value that is returned when asymmetric crypto
> > or compression service is selected.
> 
> Description is also updated. Please check.
> > 
> > Fixes: 8f393c4ffdc1 ("common/qat: support GEN4 devices")
> > 
> > Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> > ---
> 
> Applied to dpdk-next-crypto
> 
> Braces across 'EFAULT' are not needed. I tried fixing it, but it is being
> Used at many places. Please fix that in a separate patch.

There are not parenthesis for every returns,
so I will remove those introduced by this patch.
diff mbox series

Patch

diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c
index cfdcb6b3d1..92a2285b53 100644
--- a/drivers/compress/qat/qat_comp_pmd.c
+++ b/drivers/compress/qat/qat_comp_pmd.c
@@ -713,7 +713,7 @@  qat_comp_dev_create(struct qat_pci_device *qat_pci_dev,
 
 	if (qat_pci_dev->qat_dev_gen == QAT_GEN4) {
 		QAT_LOG(ERR, "Compression PMD not supported on QAT 4xxx");
-		return 0;
+		return -(EFAULT);
 	}
 	snprintf(name, RTE_COMPRESSDEV_NAME_MAX_LEN, "%s_%s",
 			qat_pci_dev->name, "comp");
diff --git a/drivers/crypto/qat/qat_asym_pmd.c b/drivers/crypto/qat/qat_asym_pmd.c
index 56ccca36d1..d4680c3847 100644
--- a/drivers/crypto/qat/qat_asym_pmd.c
+++ b/drivers/crypto/qat/qat_asym_pmd.c
@@ -253,7 +253,7 @@  qat_asym_dev_create(struct qat_pci_device *qat_pci_dev,
 
 	if (qat_pci_dev->qat_dev_gen == QAT_GEN4) {
 		QAT_LOG(ERR, "Asymmetric crypto PMD not supported on QAT 4xxx");
-		return 0;
+		return -(EFAULT);
 	}
 	snprintf(name, RTE_CRYPTODEV_NAME_MAX_LEN, "%s_%s",
 			qat_pci_dev->name, "asym");