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: I9e18ffc961d485225732c34d3ca561e84d182d07 Signed-off-by: Amurthyreddy <amurthyreddy@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1921370 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
30aeb71693
commit
a39c48e3e2
@@ -281,14 +281,14 @@ int boardobjgrp_pmuinithandle_impl(struct gk20a *g,
|
||||
|
||||
status = boardobjgrp_pmucmd_pmuinithandle_impl(g, pboardobjgrp,
|
||||
&pboardobjgrp->pmu.set);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "failed to init pmu set cmd");
|
||||
goto boardobjgrp_pmuinithandle_exit;
|
||||
}
|
||||
|
||||
status = boardobjgrp_pmucmd_pmuinithandle_impl(g, pboardobjgrp,
|
||||
&pboardobjgrp->pmu.getstatus);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "failed to init get status command");
|
||||
goto boardobjgrp_pmuinithandle_exit;
|
||||
}
|
||||
@@ -302,7 +302,7 @@ int boardobjgrp_pmuinithandle_impl(struct gk20a *g,
|
||||
|
||||
/* Send the BOARDOBJGRP to the pmu via RM_PMU_BOARDOBJ_CMD_GRP. */
|
||||
status = pboardobjgrp->pmuset(g, pboardobjgrp);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "failed to send boardobg grp to PMU");
|
||||
}
|
||||
|
||||
@@ -382,14 +382,14 @@ int boardobjgrp_pmudatainit_legacy(struct gk20a *g,
|
||||
status = pboardobjgrp->pmudatainstget(g,
|
||||
(struct nv_pmu_boardobjgrp *)pboardobjgrppmu,
|
||||
&ppmudata, index);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "could not get object instance");
|
||||
goto boardobjgrppmudatainit_legacy_done;
|
||||
}
|
||||
|
||||
/* Initialize the PMU Data */
|
||||
status = pboardobj->pmudatainit(g, pboardobj, ppmudata);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g,
|
||||
"could not parse pmu for device %d", index);
|
||||
goto boardobjgrppmudatainit_legacy_done;
|
||||
@@ -422,7 +422,7 @@ int boardobjgrp_pmudatainit_super(struct gk20a *g, struct boardobjgrp
|
||||
/* Initialize the PMU HDR data.*/
|
||||
status = pboardobjgrp->pmuhdrdatainit(g, pboardobjgrp, pboardobjgrppmu,
|
||||
pboardobjgrp->mask);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "unable to init boardobjgrp pmuhdr data");
|
||||
goto boardobjgrppmudatainit_super_done;
|
||||
}
|
||||
@@ -431,14 +431,14 @@ int boardobjgrp_pmudatainit_super(struct gk20a *g, struct boardobjgrp
|
||||
status = pboardobjgrp->pmudatainstget(g,
|
||||
(struct nv_pmu_boardobjgrp *)pboardobjgrppmu,
|
||||
&ppmudata, index);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "could not get object instance");
|
||||
goto boardobjgrppmudatainit_super_done;
|
||||
}
|
||||
|
||||
/* Initialize the PMU Data and send to PMU */
|
||||
status = pboardobj->pmudatainit(g, pboardobj, ppmudata);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g,
|
||||
"could not parse pmu for device %d", index);
|
||||
goto boardobjgrppmudatainit_super_done;
|
||||
@@ -503,7 +503,7 @@ int boardobjgrp_pmuset_impl(struct gk20a *g, struct boardobjgrp *pboardobjgrp)
|
||||
memset(pcmd->buf, 0x0, pcmd->fbsize);
|
||||
status = pboardobjgrp->pmudatainit(g, pboardobjgrp,
|
||||
pcmd->buf);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "could not parse pmu data");
|
||||
goto boardobjgrp_pmuset_exit;
|
||||
}
|
||||
@@ -527,7 +527,7 @@ int boardobjgrp_pmuset_impl(struct gk20a *g, struct boardobjgrp *pboardobjgrp)
|
||||
/* Send the SET PMU CMD to the PMU */
|
||||
status = boardobjgrp_pmucmdsend(g, pboardobjgrp,
|
||||
pcmd);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "could not send SET CMD to PMU");
|
||||
goto boardobjgrp_pmuset_exit;
|
||||
}
|
||||
@@ -562,7 +562,7 @@ int boardobjgrp_pmuset_impl_v1(struct gk20a *g,
|
||||
memset(pcmd->buf, 0x0, pcmd->fbsize);
|
||||
status = pboardobjgrp->pmudatainit(g, pboardobjgrp,
|
||||
pcmd->buf);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "could not parse pmu data");
|
||||
goto boardobjgrp_pmuset_exit;
|
||||
}
|
||||
@@ -584,7 +584,7 @@ int boardobjgrp_pmuset_impl_v1(struct gk20a *g,
|
||||
/* Send the SET PMU CMD to the PMU using RPC*/
|
||||
status = boardobjgrp_pmucmdsend_rpc(g, pboardobjgrp,
|
||||
pcmd, false);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "could not send SET CMD to PMU");
|
||||
goto boardobjgrp_pmuset_exit;
|
||||
}
|
||||
@@ -646,7 +646,7 @@ boardobjgrp_pmugetstatus_impl(struct gk20a *g, struct boardobjgrp *pboardobjgrp,
|
||||
memset(pcmd->buf, 0x0, pcmd->fbsize);
|
||||
status = pboardobjgrp->pmuhdrdatainit(g, pboardobjgrp,
|
||||
pcmd->buf, mask);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "could not init PMU HDR data");
|
||||
goto boardobjgrp_pmugetstatus_exit;
|
||||
}
|
||||
@@ -655,7 +655,7 @@ boardobjgrp_pmugetstatus_impl(struct gk20a *g, struct boardobjgrp *pboardobjgrp,
|
||||
/* Send the GET_STATUS PMU CMD to the PMU */
|
||||
status = boardobjgrp_pmucmdsend(g, pboardobjgrp,
|
||||
&pboardobjgrp->pmu.getstatus);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "could not send GET_STATUS cmd to PMU");
|
||||
goto boardobjgrp_pmugetstatus_exit;
|
||||
}
|
||||
@@ -703,7 +703,7 @@ boardobjgrp_pmugetstatus_impl_v1(struct gk20a *g, struct boardobjgrp *pboardobjg
|
||||
memset(pcmd->buf, 0x0, pcmd->fbsize);
|
||||
status = pboardobjgrp->pmuhdrdatainit(g, pboardobjgrp,
|
||||
pcmd->buf, mask);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "could not init PMU HDR data");
|
||||
goto boardobjgrp_pmugetstatus_exit;
|
||||
}
|
||||
@@ -717,7 +717,7 @@ boardobjgrp_pmugetstatus_impl_v1(struct gk20a *g, struct boardobjgrp *pboardobjg
|
||||
/* Send the GET_STATUS PMU CMD to the PMU */
|
||||
status = boardobjgrp_pmucmdsend_rpc(g, pboardobjgrp,
|
||||
pcmd, true);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "could not send GET_STATUS cmd to PMU");
|
||||
goto boardobjgrp_pmugetstatus_exit;
|
||||
}
|
||||
@@ -992,7 +992,7 @@ static int boardobjgrp_pmucmdsend(struct gk20a *g,
|
||||
boardobjgrp_pmucmdhandler,
|
||||
(void *)&handlerparams,
|
||||
&seqdesc, ~0);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g,
|
||||
"unable to post boardobj grp cmd for unit %x cmd id %x",
|
||||
cmd.hdr.unit_id, pcmd->id);
|
||||
@@ -1038,7 +1038,7 @@ static int boardobjgrp_pmucmdsend_rpc(struct gk20a *g,
|
||||
pcmd->dmem_buffer_size,
|
||||
NULL, NULL, copy_out);
|
||||
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "Failed to execute RPC, status=0x%x", status);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ int boardobjgrpconstruct_e255(struct gk20a *g,
|
||||
|
||||
objslots = 255;
|
||||
status = boardobjgrpmask_e255_init(&pboardobjgrp_e255->mask, NULL);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
goto boardobjgrpconstruct_e255_exit;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ int boardobjgrpconstruct_e255(struct gk20a *g,
|
||||
pboardobjgrp_e255->super.mask = &(pboardobjgrp_e255->mask.super);
|
||||
|
||||
status = boardobjgrp_construct_super(g, &pboardobjgrp_e255->super);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
goto boardobjgrpconstruct_e255_exit;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ int boardobjgrp_pmuhdrdatainit_e255(struct gk20a *g,
|
||||
status = boardobjgrpmask_export(mask,
|
||||
mask->bitcount,
|
||||
&pgrpe255->obj_mask.super);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "e255 init:failed export grpmask");
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "ctrl/ctrlboardobj.h"
|
||||
|
||||
|
||||
int boardobjgrpconstruct_e32(struct gk20a *g,
|
||||
int boardobjgrpconstruct_e32(struct gk20a *g,
|
||||
struct boardobjgrp_e32 *pboardobjgrp_e32)
|
||||
{
|
||||
int status;
|
||||
@@ -38,7 +38,7 @@ int boardobjgrpconstruct_e32(struct gk20a *g,
|
||||
objslots = 32;
|
||||
|
||||
status = boardobjgrpmask_e32_init(&pboardobjgrp_e32->mask, NULL);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
goto boardobjgrpconstruct_e32_exit;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ int boardobjgrpconstruct_e32(struct gk20a *g,
|
||||
pboardobjgrp_e32->super.mask = &(pboardobjgrp_e32->mask.super);
|
||||
|
||||
status = boardobjgrp_construct_super(g, &pboardobjgrp_e32->super);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
goto boardobjgrpconstruct_e32_exit;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ int boardobjgrp_pmuhdrdatainit_e32(struct gk20a *g,
|
||||
status = boardobjgrpmask_export(mask,
|
||||
mask->bitcount,
|
||||
&pgrpe32->obj_mask.super);
|
||||
if (status) {
|
||||
if (status != 0) {
|
||||
nvgpu_err(g, "e32 init:failed export grpmask");
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#define BOARDOBJGRPMASK_NORMALIZE(_pmask) \
|
||||
((_pmask)->data[(_pmask)->maskdatacount-1U] &= (_pmask)->lastmaskfilter)
|
||||
|
||||
u32 boardobjgrpmask_init(struct boardobjgrpmask *mask, u8 bitsize,
|
||||
int boardobjgrpmask_init(struct boardobjgrpmask *mask, u8 bitsize,
|
||||
struct ctrl_boardobjgrp_mask *extmask)
|
||||
{
|
||||
if (mask == NULL) {
|
||||
@@ -54,7 +54,7 @@ u32 boardobjgrpmask_init(struct boardobjgrpmask *mask, u8 bitsize,
|
||||
boardobjgrpmask_import(mask, bitsize, extmask);
|
||||
}
|
||||
|
||||
u32 boardobjgrpmask_import(struct boardobjgrpmask *mask, u8 bitsize,
|
||||
int boardobjgrpmask_import(struct boardobjgrpmask *mask, u8 bitsize,
|
||||
struct ctrl_boardobjgrp_mask *extmask)
|
||||
{
|
||||
u8 index;
|
||||
@@ -100,7 +100,7 @@ u32 boardobjgrpmask_export(struct boardobjgrpmask *mask, u8 bitsize,
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 boardobjgrpmask_clr(struct boardobjgrpmask *mask)
|
||||
int boardobjgrpmask_clr(struct boardobjgrpmask *mask)
|
||||
{
|
||||
u8 index;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user