mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: MISRA 14.4 err/ret/status as boolean
MISRA rule 14.4 doesn't allow the usage of integer types as booleans in the controlling expression of an if statement or an iteration statement Fix violations where the integer variables err, ret, status are used as booleans in the controlling expression of if and loop statements. JIRA NVGPU-1019 Change-Id: Ia950828797b8eff4bc754269ea2d9fa272f59436 Signed-off-by: Amurthyreddy <amurthyreddy@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1919111 Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Scott Long <scottl@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Abdul Salam
parent
8033d33982
commit
c114b9e77e
@@ -250,7 +250,7 @@ static int pmu_write_cmd(struct nvgpu_pmu *pmu, struct pmu_cmd *cmd,
|
||||
}
|
||||
} while (1);
|
||||
|
||||
if (err) {
|
||||
if (err != 0) {
|
||||
nvgpu_err(g, "fail to write cmd to queue %d", queue_id);
|
||||
} else {
|
||||
nvgpu_log_fn(g, "done");
|
||||
@@ -293,7 +293,7 @@ static int pmu_cmd_payload_extract_rpc(struct gk20a *g, struct pmu_cmd *cmd,
|
||||
dmem_alloc_offset);
|
||||
|
||||
clean_up:
|
||||
if (err) {
|
||||
if (err != 0) {
|
||||
nvgpu_log_fn(g, "fail");
|
||||
} else {
|
||||
nvgpu_log_fn(g, "done");
|
||||
@@ -411,7 +411,7 @@ static int pmu_cmd_payload_extract(struct gk20a *g, struct pmu_cmd *cmd,
|
||||
}
|
||||
|
||||
clean_up:
|
||||
if (err) {
|
||||
if (err != 0) {
|
||||
nvgpu_log_fn(g, "fail");
|
||||
if (in) {
|
||||
nvgpu_free(&pmu->dmem,
|
||||
@@ -457,7 +457,7 @@ int nvgpu_pmu_cmd_post(struct gk20a *g, struct pmu_cmd *cmd,
|
||||
}
|
||||
|
||||
err = pmu_seq_acquire(pmu, &seq);
|
||||
if (err) {
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -481,14 +481,14 @@ int nvgpu_pmu_cmd_post(struct gk20a *g, struct pmu_cmd *cmd,
|
||||
err = pmu_cmd_payload_extract(g, cmd, payload, seq);
|
||||
}
|
||||
|
||||
if (err) {
|
||||
if (err != 0) {
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
seq->state = PMU_SEQ_STATE_USED;
|
||||
|
||||
err = pmu_write_cmd(pmu, cmd, queue_id, timeout);
|
||||
if (err) {
|
||||
if (err != 0) {
|
||||
seq->state = PMU_SEQ_STATE_PENDING;
|
||||
}
|
||||
|
||||
@@ -938,7 +938,7 @@ int nvgpu_pmu_rpc_execute(struct nvgpu_pmu *pmu, struct nv_pmu_rpc_header *rpc,
|
||||
status = nvgpu_pmu_cmd_post(g, &cmd, NULL, &payload,
|
||||
PMU_COMMAND_QUEUE_LPQ, callback,
|
||||
rpc_payload, &seq, ~0);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "Failed to execute RPC status=0x%x, func=0x%x",
|
||||
status, rpc->function);
|
||||
goto exit;
|
||||
@@ -960,7 +960,7 @@ int nvgpu_pmu_rpc_execute(struct nvgpu_pmu *pmu, struct nv_pmu_rpc_header *rpc,
|
||||
}
|
||||
|
||||
exit:
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
if (rpc_payload) {
|
||||
nvgpu_kfree(g, rpc_payload);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user