diff options
author | Tadeusz Struk <tadeusz.struk@intel.com> | 2014-06-24 18:19:40 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-06-26 02:49:46 -0400 |
commit | 8f312d64b5eea5c1f807265c1010969a0cb4b876 (patch) | |
tree | abd3640033e2c530bb340d5c6816303f9d5457ac /drivers/crypto/qat/qat_common | |
parent | d65071ecde1ed1b99d057a877e0e3d29748c3a4d (diff) |
crypto: qat - Fix error path crash when no firmware is present
Firmware loader crashes when no firmware file is present.
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/qat/qat_common')
-rw-r--r-- | drivers/crypto/qat/qat_common/adf_common_drv.h | 2 | ||||
-rw-r--r-- | drivers/crypto/qat/qat_common/qat_uclo.c | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/drivers/crypto/qat/qat_common/adf_common_drv.h b/drivers/crypto/qat/qat_common/adf_common_drv.h index 3cea9fa26158..5e8f9d431e5d 100644 --- a/drivers/crypto/qat/qat_common/adf_common_drv.h +++ b/drivers/crypto/qat/qat_common/adf_common_drv.h | |||
@@ -186,7 +186,7 @@ int qat_hal_init_nn(struct icp_qat_fw_loader_handle *handle, | |||
186 | int qat_hal_wr_lm(struct icp_qat_fw_loader_handle *handle, | 186 | int qat_hal_wr_lm(struct icp_qat_fw_loader_handle *handle, |
187 | unsigned char ae, unsigned short lm_addr, unsigned int value); | 187 | unsigned char ae, unsigned short lm_addr, unsigned int value); |
188 | int qat_uclo_wr_all_uimage(struct icp_qat_fw_loader_handle *handle); | 188 | int qat_uclo_wr_all_uimage(struct icp_qat_fw_loader_handle *handle); |
189 | int qat_uclo_del_uof_obj(struct icp_qat_fw_loader_handle *handle); | 189 | void qat_uclo_del_uof_obj(struct icp_qat_fw_loader_handle *handle); |
190 | int qat_uclo_map_uof_obj(struct icp_qat_fw_loader_handle *handle, | 190 | int qat_uclo_map_uof_obj(struct icp_qat_fw_loader_handle *handle, |
191 | void *addr_ptr, int mem_size); | 191 | void *addr_ptr, int mem_size); |
192 | #endif | 192 | #endif |
diff --git a/drivers/crypto/qat/qat_common/qat_uclo.c b/drivers/crypto/qat/qat_common/qat_uclo.c index 20b6b4269ca7..dd4e0d3c323a 100644 --- a/drivers/crypto/qat/qat_common/qat_uclo.c +++ b/drivers/crypto/qat/qat_common/qat_uclo.c | |||
@@ -959,8 +959,6 @@ static int qat_uclo_parse_uof_obj(struct icp_qat_fw_loader_handle *handle) | |||
959 | obj_handle->encap_uof_obj.beg_uof = obj_handle->obj_hdr->file_buff; | 959 | obj_handle->encap_uof_obj.beg_uof = obj_handle->obj_hdr->file_buff; |
960 | obj_handle->encap_uof_obj.obj_hdr = (struct icp_qat_uof_objhdr *) | 960 | obj_handle->encap_uof_obj.obj_hdr = (struct icp_qat_uof_objhdr *) |
961 | obj_handle->obj_hdr->file_buff; | 961 | obj_handle->obj_hdr->file_buff; |
962 | obj_handle->encap_uof_obj.chunk_hdr = (struct icp_qat_uof_chunkhdr *) | ||
963 | (obj_handle->obj_hdr->file_buff + sizeof(struct icp_qat_uof_objhdr)); | ||
964 | obj_handle->uword_in_bytes = 6; | 962 | obj_handle->uword_in_bytes = 6; |
965 | obj_handle->prod_type = ICP_QAT_AC_C_CPU_TYPE; | 963 | obj_handle->prod_type = ICP_QAT_AC_C_CPU_TYPE; |
966 | obj_handle->prod_rev = PID_MAJOR_REV | | 964 | obj_handle->prod_rev = PID_MAJOR_REV | |
@@ -1040,23 +1038,25 @@ out_objbuf_err: | |||
1040 | return -ENOMEM; | 1038 | return -ENOMEM; |
1041 | } | 1039 | } |
1042 | 1040 | ||
1043 | int qat_uclo_del_uof_obj(struct icp_qat_fw_loader_handle *handle) | 1041 | void qat_uclo_del_uof_obj(struct icp_qat_fw_loader_handle *handle) |
1044 | { | 1042 | { |
1045 | struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; | 1043 | struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; |
1046 | int a; | 1044 | int a; |
1047 | 1045 | ||
1046 | if (!obj_handle) | ||
1047 | return; | ||
1048 | |||
1048 | kfree(obj_handle->uword_buf); | 1049 | kfree(obj_handle->uword_buf); |
1049 | for (a = 0; a < obj_handle->uimage_num; a++) | 1050 | for (a = 0; a < obj_handle->uimage_num; a++) |
1050 | kfree(obj_handle->ae_uimage[a].page); | 1051 | kfree(obj_handle->ae_uimage[a].page); |
1051 | 1052 | ||
1052 | for (a = 0; a <= (int)handle->hal_handle->ae_max_num; a++) | 1053 | for (a = 0; a <= (int)handle->hal_handle->ae_max_num; a++) |
1053 | qat_uclo_free_ae_data(&obj_handle->ae_data[a]); | 1054 | qat_uclo_free_ae_data(&obj_handle->ae_data[a]); |
1054 | kfree(obj_handle->obj_hdr); | ||
1055 | 1055 | ||
1056 | kfree(obj_handle->obj_hdr); | ||
1056 | kfree(obj_handle->obj_buf); | 1057 | kfree(obj_handle->obj_buf); |
1057 | kfree(obj_handle); | 1058 | kfree(obj_handle); |
1058 | handle->obj_handle = NULL; | 1059 | handle->obj_handle = NULL; |
1059 | return 0; | ||
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | static void qat_uclo_fill_uwords(struct icp_qat_uclo_objhandle *obj_handle, | 1062 | static void qat_uclo_fill_uwords(struct icp_qat_uclo_objhandle *obj_handle, |