Skip to contentSkip to conversation

crypto: atmel-ecc - simplify atmel_ecdh_compute_shared_secret

PATCH In review Thorsten Blum 2 participants 2 messages Sep 1 – Sep 16

Subsystems (3)
lore
Share & tools
lore

Thorsten Blum

author maintainer
#0 lore raw

PATCH 1/1 crypto: atmel-ecc - simplify atmel_ecdh_compute_shared_secret

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

---
 drivers/crypto/atmel-ecc.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/crypto/atmel-ecc.c +4 -6
index 075f38a67935..ad9f031cbc29 100644
@@ -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)
maintainer
#1 lore raw
Quoted 6 lines · Thorsten Blum

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

---
 drivers/crypto/atmel-ecc.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt