Make sure we free the memory even if the unload fails.
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
void **pptr;
ret = psp_tmr_unload(psp);
void **pptr;
ret = psp_tmr_unload(psp);
/* free TMR memory buffer */
pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL;
amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, pptr);
/* free TMR memory buffer */
pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL;
amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, pptr);
}
int psp_get_fw_attestation_records_addr(struct psp_context *psp,
}
int psp_get_fw_attestation_records_addr(struct psp_context *psp,
return 0;
ret = psp_ta_unload(psp, &psp->xgmi_context.context);
return 0;
ret = psp_ta_unload(psp, &psp->xgmi_context.context);
psp->xgmi_context.context.initialized = false;
/* free xgmi shared memory */
psp_ta_free_shared_buf(&psp->xgmi_context.context.mem_context);
psp->xgmi_context.context.initialized = false;
/* free xgmi shared memory */
psp_ta_free_shared_buf(&psp->xgmi_context.context.mem_context);
}
int psp_xgmi_initialize(struct psp_context *psp, bool set_extended_data, bool load_ta)
}
int psp_xgmi_initialize(struct psp_context *psp, bool set_extended_data, bool load_ta)
return 0;
ret = psp_ta_unload(psp, &psp->ras_context.context);
return 0;
ret = psp_ta_unload(psp, &psp->ras_context.context);
psp->ras_context.context.initialized = false;
/* free ras shared memory */
psp_ta_free_shared_buf(&psp->ras_context.context.mem_context);
psp->ras_context.context.initialized = false;
/* free ras shared memory */
psp_ta_free_shared_buf(&psp->ras_context.context.mem_context);
}
static int psp_ras_initialize(struct psp_context *psp)
}
static int psp_ras_initialize(struct psp_context *psp)
return 0;
if (!psp->hdcp_context.context.initialized) {
return 0;
if (!psp->hdcp_context.context.initialized) {
- if (psp->hdcp_context.context.mem_context.shared_buf)
+ if (psp->hdcp_context.context.mem_context.shared_buf) {
+ ret = 0;
}
ret = psp_ta_unload(psp, &psp->hdcp_context.context);
}
ret = psp_ta_unload(psp, &psp->hdcp_context.context);
psp->hdcp_context.context.initialized = false;
psp->hdcp_context.context.initialized = false;
/* free hdcp shared memory */
psp_ta_free_shared_buf(&psp->hdcp_context.context.mem_context);
/* free hdcp shared memory */
psp_ta_free_shared_buf(&psp->hdcp_context.context.mem_context);
return 0;
if (!psp->dtm_context.context.initialized) {
return 0;
if (!psp->dtm_context.context.initialized) {
- if (psp->dtm_context.context.mem_context.shared_buf)
+ if (psp->dtm_context.context.mem_context.shared_buf) {
+ ret = 0;
}
ret = psp_ta_unload(psp, &psp->dtm_context.context);
}
ret = psp_ta_unload(psp, &psp->dtm_context.context);
psp->dtm_context.context.initialized = false;
psp->dtm_context.context.initialized = false;
/* free dtm shared memory */
psp_ta_free_shared_buf(&psp->dtm_context.context.mem_context);
/* free dtm shared memory */
psp_ta_free_shared_buf(&psp->dtm_context.context.mem_context);
return 0;
ret = psp_ta_unload(psp, &psp->securedisplay_context.context);
return 0;
ret = psp_ta_unload(psp, &psp->securedisplay_context.context);
psp->securedisplay_context.context.initialized = false;
psp->securedisplay_context.context.initialized = false;