Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1475208 > unrolled thread

[PATCH 1/2][RESEND] crypto: qat - introduces a variable to handle error codes

Started byQuentin Lambert <lambert.quentin@gmail.com>
First post2016-09-02 16:50 +0200
Last post2016-09-02 16:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/2][RESEND] crypto: qat - introduces a variable to handle error codes Quentin Lambert <lambert.quentin@gmail.com> - 2016-09-02 16:50 +0200

#1475208 — [PATCH 1/2][RESEND] crypto: qat - introduces a variable to handle error codes

FromQuentin Lambert <lambert.quentin@gmail.com>
Date2016-09-02 16:50 +0200
Subject[PATCH 1/2][RESEND] crypto: qat - introduces a variable to handle error codes
Message-ID<scXX3-HA-9@gated-at.bofh.it>
Most error code used to jump to a label that lead to a "return -EFAULT"
statement. This patch introduces a variable that stores the error code
so that other error branches can use the same label to exit.

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>

---
 drivers/crypto/qat/qat_common/qat_uclo.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

--- a/drivers/crypto/qat/qat_common/qat_uclo.c
+++ b/drivers/crypto/qat/qat_common/qat_uclo.c
@@ -966,6 +966,7 @@ static int qat_uclo_parse_uof_obj(struct
 {
 	struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle;
 	unsigned int ae;
+	int ret;
 
 	obj_handle->uword_buf = kcalloc(UWORD_CPYBUF_SIZE, sizeof(uint64_t),
 					GFP_KERNEL);
@@ -987,29 +988,35 @@ static int qat_uclo_parse_uof_obj(struct
 	    !qat_uclo_map_str_table(obj_handle->obj_hdr, ICP_QAT_UOF_STRT,
 				    &obj_handle->str_table)) {
 		pr_err("QAT: UOF doesn't have effective images\n");
+		ret = -EFAULT;
 		goto out_err;
 	}
 	obj_handle->uimage_num =
 		qat_uclo_map_uimage(obj_handle, obj_handle->ae_uimage,
 				    ICP_QAT_UCLO_MAX_AE * ICP_QAT_UCLO_MAX_CTX);
-	if (!obj_handle->uimage_num)
+	if (!obj_handle->uimage_num) {
+		ret = -EFAULT;
 		goto out_err;
+	}
 	if (qat_uclo_map_ae(handle, handle->hal_handle->ae_max_num)) {
 		pr_err("QAT: Bad object\n");
+		ret = -EFAULT;
 		goto out_check_uof_aemask_err;
 	}
 	qat_uclo_init_uword_num(handle);
 	qat_uclo_map_initmem_table(&obj_handle->encap_uof_obj,
 				   &obj_handle->init_mem_tab);
-	if (qat_uclo_set_ae_mode(handle))
+	if (qat_uclo_set_ae_mode(handle)) {
+		ret = -EFAULT;
 		goto out_check_uof_aemask_err;
+	}
 	return 0;
 out_check_uof_aemask_err:
 	for (ae = 0; ae < obj_handle->uimage_num; ae++)
 		kfree(obj_handle->ae_uimage[ae].page);
 out_err:
 	kfree(obj_handle->uword_buf);
-	return -EFAULT;
+	return ret;
 }
 
 static int qat_uclo_map_suof_file_hdr(struct icp_qat_fw_loader_handle *handle,

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web