mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: fix MISRA 13.5 nvgpu.hal.nvlink
MISRA rule 13.5 doesn't allow right-hand operand of logical && or || operator to have persistent side effects. The reason is right-hand operand is executed or checked depending on the left-hand operand value. That means side effects in the right-hand operand may or may not occur, contrary to programmer's expectation. Hence, this rule is implemented to avoid unexpected behavior. This patch divides if condition with logical && operator to nested if conditions to resolve this violation. Jira NVGPU-3277 Change-Id: I9f4387d71427821278db6bbda2eb53bd4d8ea543 Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2119684 Reviewed-by: Philip Elcan <pelcan@nvidia.com> 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: Vinod Gopalakrishnakurup <vinodg@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
mobile promotions
parent
af2ccb811d
commit
54e179ddad
@@ -60,11 +60,12 @@ u32 gv100_nvlink_minion_base_addr(struct gk20a *g)
|
||||
bool gv100_nvlink_minion_is_running(struct gk20a *g)
|
||||
{
|
||||
/* if minion is booted and not halted, it is running */
|
||||
if (((MINION_REG_RD32(g, minion_minion_status_r()) &
|
||||
minion_minion_status_status_f(1)) != 0U) &&
|
||||
((minion_falcon_irqstat_halt_v(
|
||||
MINION_REG_RD32(g, minion_falcon_irqstat_r()))) == 0U)) {
|
||||
return true;
|
||||
if ((MINION_REG_RD32(g, minion_minion_status_r()) &
|
||||
minion_minion_status_status_f(1)) != 0U) {
|
||||
if (minion_falcon_irqstat_halt_v(
|
||||
MINION_REG_RD32(g, minion_falcon_irqstat_r())) == 0U) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user