Removed unncessary session check which could lead to segfault,
in case api was changed.

Fixes: 002486db239e ("crypto/qat: refactor asymmetric session")

Signed-off-by: Arek Kusztal <arkadiuszx.kusz...@intel.com>
---
v2:
- fixed compilation issues
- split into 3 patches

 drivers/crypto/qat/qat_asym.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c
index 3d7a800392..0eb5ba79bc 100644
--- a/drivers/crypto/qat/qat_asym.c
+++ b/drivers/crypto/qat/qat_asym.c
@@ -808,15 +808,15 @@ qat_asym_build_request(void *in_op, uint8_t *out_msg, 
void *op_cookie,
        int err = 0;
 
        op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
-       if (unlikely(qat_session == NULL)) {
-               QAT_DP_LOG(ERR, "Session was not created for this device");
-               op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
-               goto error;
-       }
-
        switch (op->sess_type) {
        case RTE_CRYPTO_OP_WITH_SESSION:
                request_init(qat_req);
+               if (unlikely(qat_session == NULL)) {
+                       QAT_DP_LOG(ERR,
+                               "Session was not created for this device");
+                       op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
+                       goto error;
+               }
                xform = &qat_session->xform;
                break;
        case RTE_CRYPTO_OP_SESSIONLESS:
-- 
2.13.6

Reply via email to