If odp_crypto_session_create() failed, there is no point in
checking/freeing session, as it might not have been updated.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsoleni...@linaro.org>
---
 test/common_plat/performance/odp_crypto.c | 44 +++++++++++++++----------------
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/test/common_plat/performance/odp_crypto.c 
b/test/common_plat/performance/odp_crypto.c
index 6a58294a25ff..c3dd6d38f3cb 100644
--- a/test/common_plat/performance/odp_crypto.c
+++ b/test/common_plat/performance/odp_crypto.c
@@ -665,34 +665,32 @@ run_measure_one_config(crypto_args_t *cargs,
        int rc = 0;
 
        if (create_session_from_config(&session, config, cargs))
-               rc = -1;
-
-       if (!rc) {
-               if (cargs->payload_length) {
-                       rc = run_measure_one(cargs, config, &session,
-                                            cargs->payload_length, &result);
-                       if (!rc) {
-                               print_result_header();
-                               print_result(cargs, cargs->payload_length,
-                                            config, &result);
-                       }
-               } else {
-                       unsigned i;
+               return -1;
 
+       if (cargs->payload_length) {
+               rc = run_measure_one(cargs, config, &session,
+                                    cargs->payload_length, &result);
+               if (!rc) {
                        print_result_header();
-                       for (i = 0; i < num_payloads; i++) {
-                               rc = run_measure_one(cargs, config, &session,
-                                                    payloads[i], &result);
-                               if (rc)
-                                       break;
-                               print_result(cargs, payloads[i],
-                                            config, &result);
-                       }
+                       print_result(cargs, cargs->payload_length,
+                                    config, &result);
+               }
+       } else {
+               unsigned i;
+
+               print_result_header();
+               for (i = 0; i < num_payloads; i++) {
+                       rc = run_measure_one(cargs, config, &session,
+                                            payloads[i], &result);
+                       if (rc)
+                               break;
+                       print_result(cargs, payloads[i],
+                                    config, &result);
                }
        }
 
-       if (session != ODP_CRYPTO_SESSION_INVALID)
-               odp_crypto_session_destroy(session);
+       odp_crypto_session_destroy(session);
+
        return rc;
 }
 
-- 
2.11.0

Reply via email to