[PATCH] crypto: atmel-ecc - simplify atmel_ecdh_compute_shared_secret

Thorsten Blum blum at kernel.org
Tue Sep 1 01:11:27 PDT 2026


Free work_data and return ret directly to simplify the control flow.

Signed-off-by: Thorsten Blum <blum at kernel.org>
---
 drivers/crypto/atmel-ecc.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/atmel-ecc.c b/drivers/crypto/atmel-ecc.c
index 075f38a67935..ad9f031cbc29 100644
--- a/drivers/crypto/atmel-ecc.c
+++ b/drivers/crypto/atmel-ecc.c
@@ -177,16 +177,14 @@ static int atmel_ecdh_compute_shared_secret(struct kpp_request *req)
 	work_data->client = ctx->client;
 
 	ret = atmel_i2c_init_ecdh_cmd(&work_data->cmd, req->src);
-	if (ret)
-		goto free_work_data;
+	if (ret) {
+		kfree(work_data);
+		return ret;
+	}
 
 	atmel_i2c_enqueue(work_data, atmel_ecdh_done, req);
 
 	return -EINPROGRESS;
-
-free_work_data:
-	kfree(work_data);
-	return ret;
 }
 
 static struct i2c_client *atmel_ecc_i2c_client_alloc(void)



More information about the linux-arm-kernel mailing list