From c0a4a7bb942fd3302f0093e4353820916d3661d1 Mon Sep 17 00:00:00 2001 From: Krzysztof Zdziarski Date: Wed, 1 Feb 2023 15:06:11 +0000 Subject: [PATCH] qat: Fixed Coverity reported issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch provides fixes for following Coverity issues: CID 1504073 CID 1504075 CID 1504076 CID 1504077 Patch co-authored by: Krzysztof Zdziarski Patch co-authored by: Michal Gulbicki Patch co-authored by: Julian Grajkowski Patch co-authored by: Piotr Kasierski Patch co-authored by: Lukasz Kolodzinski Patch co-authored by: Karol Grzadziel Fixes: a977168c48d4 ("qat: Add IntelĀ® 4xxx Series platform support") Reviewed by: markj Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D38339 --- .../qat/qat_api/common/compression/dc_datapath.c | 14 ++++++-------- sys/dev/qat/qat_common/adf_hw_arbiter.c | 3 ++- sys/dev/qat/qat_hw/qat_4xxx/adf_4xxx_hw_data.c | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/sys/dev/qat/qat_api/common/compression/dc_datapath.c b/sys/dev/qat/qat_api/common/compression/dc_datapath.c index 2e1f9ff96bd8..526954e15227 100644 --- a/sys/dev/qat/qat_api/common/compression/dc_datapath.c +++ b/sys/dev/qat/qat_api/common/compression/dc_datapath.c @@ -152,6 +152,7 @@ dcCompression_ProcessCallback(void *pRespMsg) if (NULL != pOpData) { verifyHwIntegrityCrcs = pOpData->verifyHwIntegrityCrcs; + integrityCrcCheck = pOpData->integrityCrcCheck; } hdrFlags = pCompRespMsg->comn_resp.hdr_flags; @@ -175,10 +176,9 @@ dcCompression_ProcessCallback(void *pRespMsg) (pService->pDcDpCb)(pResponse); } else { /* Free the memory pool */ - if (NULL != pCookie) { - Lac_MemPoolEntryFree(pCookie); - pCookie = NULL; - } + Lac_MemPoolEntryFree(pCookie); + pCookie = NULL; + if (NULL != pCbFunc) { pCbFunc(callbackTag, status); } @@ -432,10 +432,8 @@ dcCompression_ProcessCallback(void *pRespMsg) } /* Free the memory pool */ - if (NULL != pCookie) { - Lac_MemPoolEntryFree(pCookie); - pCookie = NULL; - } + Lac_MemPoolEntryFree(pCookie); + pCookie = NULL; if (NULL != pCbFunc) { pCbFunc(callbackTag, status); diff --git a/sys/dev/qat/qat_common/adf_hw_arbiter.c b/sys/dev/qat/qat_common/adf_hw_arbiter.c index e89a5f6ce68c..827d612e2c22 100644 --- a/sys/dev/qat/qat_common/adf_hw_arbiter.c +++ b/sys/dev/qat/qat_common/adf_hw_arbiter.c @@ -193,7 +193,7 @@ adf_exit_arb(struct adf_accel_dev *accel_dev) void adf_disable_arb(struct adf_accel_dev *accel_dev) { - struct adf_hw_csr_ops *csr_ops = GET_CSR_OPS(accel_dev); + struct adf_hw_csr_ops *csr_ops; struct resource *csr; unsigned int i; @@ -201,6 +201,7 @@ adf_disable_arb(struct adf_accel_dev *accel_dev) return; csr = accel_dev->transport->banks[0].csr_addr; + csr_ops = GET_CSR_OPS(accel_dev); /* Disable arbitration on all rings */ for (i = 0; i < GET_MAX_BANKS(accel_dev); i++) diff --git a/sys/dev/qat/qat_hw/qat_4xxx/adf_4xxx_hw_data.c b/sys/dev/qat/qat_hw/qat_4xxx/adf_4xxx_hw_data.c index 1c8c9a2fda4c..002ea6d5d876 100644 --- a/sys/dev/qat/qat_hw/qat_4xxx/adf_4xxx_hw_data.c +++ b/sys/dev/qat/qat_hw/qat_4xxx/adf_4xxx_hw_data.c @@ -747,7 +747,7 @@ static bool check_accel_unit_service(enum adf_accel_unit_services au_srv, enum adf_cfg_service_type ring_srv) { - if ((au_srv & ADF_ACCEL_SERVICE_NULL) && ring_srv == NA) + if ((ADF_ACCEL_SERVICE_NULL == au_srv) && ring_srv == NA) return true; if ((au_srv & ADF_ACCEL_COMPRESSION) && ring_srv == COMP) return true;