gpu: nvgpu: address CCM deviations for pmu_cmd_post and rpc_execute

nvgpu_pmu_cmd_post and nvgpu_pmu_rpc_execute CCM values were higher than
10. Address the same by moving cmd checks to pmu_validate_cmd and right
cleanup in nvgpu_pmu_rpc_execute.

JIRA NVGPU-3194

Change-Id: I5357a2469b256d4540881ad23f592dcee725511b
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2101942
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sagar Kamble
2019-04-21 09:34:56 +05:30
committed by mobile promotions
parent 6d1dc93117
commit 2f3314fb9e

View File

@@ -88,6 +88,11 @@ static bool pmu_validate_cmd(struct nvgpu_pmu *pmu, struct pmu_cmd *cmd,
struct gk20a *g = gk20a_from_pmu(pmu);
u32 queue_size;
if (cmd == NULL) {
nvgpu_err(g, "PMU cmd buffer is NULL");
return false;
}
if (!PMU_IS_SW_COMMAND_QUEUE(queue_id)) {
goto invalid_cmd;
}
@@ -586,14 +591,8 @@ int nvgpu_pmu_cmd_post(struct gk20a *g, struct pmu_cmd *cmd,
nvgpu_log_fn(g, " ");
if (cmd == NULL || !nvgpu_pmu_get_fw_ready(g, pmu)) {
if (cmd == NULL) {
nvgpu_warn(g, "%s(): PMU cmd buffer is NULL", __func__);
} else {
nvgpu_warn(g, "%s(): PMU is not ready", __func__);
}
WARN_ON(true);
if (!nvgpu_pmu_get_fw_ready(g, pmu)) {
nvgpu_warn(g, "PMU is not ready");
return -EINVAL;
}
@@ -748,7 +747,7 @@ int nvgpu_pmu_rpc_execute(struct nvgpu_pmu *pmu, struct nv_pmu_rpc_header *rpc,
if (status != 0) {
nvgpu_err(g, "Failed to execute RPC status=0x%x, func=0x%x",
status, rpc->function);
goto exit;
goto cleanup;
}
/*
@@ -766,12 +765,10 @@ int nvgpu_pmu_rpc_execute(struct nvgpu_pmu *pmu, struct nv_pmu_rpc_header *rpc,
nvgpu_kfree(g, rpc_payload);
}
exit:
if (status != 0) {
if (rpc_payload != NULL) {
nvgpu_kfree(g, rpc_payload);
}
}
return 0;
cleanup:
nvgpu_kfree(g, rpc_payload);
exit:
return status;
}