diff mbox series

[API-NEXT,v2,1/3] linux-gen: crypto: drop extra memcpy on result return

Message ID 1510538405-474-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v2,1/3] linux-gen: crypto: drop extra memcpy on result return | expand

Commit Message

Github ODP bot Nov. 13, 2017, 2 a.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


There is no need to fill local struct and then copy it to packet. Just
fill packet data directly, saving one memcpy call.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 294 (lumag:crypto-err-flag)
 ** https://github.com/Linaro/odp/pull/294
 ** Patch: https://github.com/Linaro/odp/pull/294.patch
 ** Base sha: a908a4dead95321e84d6a8a23de060051dcd8969
 ** Merge commit sha: d4ef7e80916d7a2c5f5fb1032bed9e07488cbe69
 **/
 platform/linux-generic/odp_crypto.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index f34863bf2..79be510d4 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -1158,7 +1158,6 @@  int odp_crypto_int(odp_packet_t pkt_in,
 	odp_crypto_alg_err_t rc_cipher = ODP_CRYPTO_ALG_ERR_NONE;
 	odp_crypto_alg_err_t rc_auth = ODP_CRYPTO_ALG_ERR_NONE;
 	odp_crypto_generic_session_t *session;
-	odp_crypto_packet_result_t local_result;
 	odp_bool_t allocated = false;
 	odp_packet_t out_pkt = *pkt_out;
 	odp_crypto_packet_result_t *op_result;
@@ -1204,18 +1203,16 @@  int odp_crypto_int(odp_packet_t pkt_in,
 	}
 
 	/* Fill in result */
-	local_result.cipher_status.alg_err = rc_cipher;
-	local_result.cipher_status.hw_err = ODP_CRYPTO_HW_ERR_NONE;
-	local_result.auth_status.alg_err = rc_auth;
-	local_result.auth_status.hw_err = ODP_CRYPTO_HW_ERR_NONE;
-	local_result.ok =
-		(rc_cipher == ODP_CRYPTO_ALG_ERR_NONE) &&
-		(rc_auth == ODP_CRYPTO_ALG_ERR_NONE);
-
 	_odp_buffer_event_subtype_set(packet_to_buffer(out_pkt),
 				      ODP_EVENT_PACKET_CRYPTO);
 	op_result = get_op_result_from_packet(out_pkt);
-	*op_result = local_result;
+	op_result->cipher_status.alg_err = rc_cipher;
+	op_result->cipher_status.hw_err = ODP_CRYPTO_HW_ERR_NONE;
+	op_result->auth_status.alg_err = rc_auth;
+	op_result->auth_status.hw_err = ODP_CRYPTO_HW_ERR_NONE;
+	op_result->ok =
+		(rc_cipher == ODP_CRYPTO_ALG_ERR_NONE) &&
+		(rc_auth == ODP_CRYPTO_ALG_ERR_NONE);
 
 	/* Synchronous, simply return results */
 	*pkt_out = out_pkt;