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>
This commit is contained in:
parent
d65071ecde
commit
8f312d64b5
|
@ -186,7 +186,7 @@ int qat_hal_init_nn(struct icp_qat_fw_loader_handle *handle,
|
||||||
int qat_hal_wr_lm(struct icp_qat_fw_loader_handle *handle,
|
int qat_hal_wr_lm(struct icp_qat_fw_loader_handle *handle,
|
||||||
unsigned char ae, unsigned short lm_addr, unsigned int value);
|
unsigned char ae, unsigned short lm_addr, unsigned int value);
|
||||||
int qat_uclo_wr_all_uimage(struct icp_qat_fw_loader_handle *handle);
|
int qat_uclo_wr_all_uimage(struct icp_qat_fw_loader_handle *handle);
|
||||||
int qat_uclo_del_uof_obj(struct icp_qat_fw_loader_handle *handle);
|
void qat_uclo_del_uof_obj(struct icp_qat_fw_loader_handle *handle);
|
||||||
int qat_uclo_map_uof_obj(struct icp_qat_fw_loader_handle *handle,
|
int qat_uclo_map_uof_obj(struct icp_qat_fw_loader_handle *handle,
|
||||||
void *addr_ptr, int mem_size);
|
void *addr_ptr, int mem_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -959,8 +959,6 @@ static int qat_uclo_parse_uof_obj(struct icp_qat_fw_loader_handle *handle)
|
||||||
obj_handle->encap_uof_obj.beg_uof = obj_handle->obj_hdr->file_buff;
|
obj_handle->encap_uof_obj.beg_uof = obj_handle->obj_hdr->file_buff;
|
||||||
obj_handle->encap_uof_obj.obj_hdr = (struct icp_qat_uof_objhdr *)
|
obj_handle->encap_uof_obj.obj_hdr = (struct icp_qat_uof_objhdr *)
|
||||||
obj_handle->obj_hdr->file_buff;
|
obj_handle->obj_hdr->file_buff;
|
||||||
obj_handle->encap_uof_obj.chunk_hdr = (struct icp_qat_uof_chunkhdr *)
|
|
||||||
(obj_handle->obj_hdr->file_buff + sizeof(struct icp_qat_uof_objhdr));
|
|
||||||
obj_handle->uword_in_bytes = 6;
|
obj_handle->uword_in_bytes = 6;
|
||||||
obj_handle->prod_type = ICP_QAT_AC_C_CPU_TYPE;
|
obj_handle->prod_type = ICP_QAT_AC_C_CPU_TYPE;
|
||||||
obj_handle->prod_rev = PID_MAJOR_REV |
|
obj_handle->prod_rev = PID_MAJOR_REV |
|
||||||
|
@ -1040,23 +1038,25 @@ out_objbuf_err:
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
int qat_uclo_del_uof_obj(struct icp_qat_fw_loader_handle *handle)
|
void qat_uclo_del_uof_obj(struct icp_qat_fw_loader_handle *handle)
|
||||||
{
|
{
|
||||||
struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle;
|
struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle;
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
|
if (!obj_handle)
|
||||||
|
return;
|
||||||
|
|
||||||
kfree(obj_handle->uword_buf);
|
kfree(obj_handle->uword_buf);
|
||||||
for (a = 0; a < obj_handle->uimage_num; a++)
|
for (a = 0; a < obj_handle->uimage_num; a++)
|
||||||
kfree(obj_handle->ae_uimage[a].page);
|
kfree(obj_handle->ae_uimage[a].page);
|
||||||
|
|
||||||
for (a = 0; a <= (int)handle->hal_handle->ae_max_num; a++)
|
for (a = 0; a <= (int)handle->hal_handle->ae_max_num; a++)
|
||||||
qat_uclo_free_ae_data(&obj_handle->ae_data[a]);
|
qat_uclo_free_ae_data(&obj_handle->ae_data[a]);
|
||||||
kfree(obj_handle->obj_hdr);
|
|
||||||
|
|
||||||
|
kfree(obj_handle->obj_hdr);
|
||||||
kfree(obj_handle->obj_buf);
|
kfree(obj_handle->obj_buf);
|
||||||
kfree(obj_handle);
|
kfree(obj_handle);
|
||||||
handle->obj_handle = NULL;
|
handle->obj_handle = NULL;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qat_uclo_fill_uwords(struct icp_qat_uclo_objhandle *obj_handle,
|
static void qat_uclo_fill_uwords(struct icp_qat_uclo_objhandle *obj_handle,
|
||||||
|
|
Loading…
Reference in New Issue