gpu: nvgpu: mm: fix MISRA 13.5 violations in page_table

Fix MISRA rule 13.5 violation for using a function that has side effects
as the right hand side of a logical expression. In this case,
is_iommuable() can have side effects in some OS implementations.

JIRA NVGPU-3340

Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Change-Id: If465f68fce0e9d6d8ef98564229eebd112b28f29
Reviewed-on: https://git-master.nvidia.com/r/2120490
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:
Philip Elcan
2019-05-16 11:32:06 -04:00
committed by mobile promotions
parent 40d9609eff
commit f8f9dfeea8

View File

@@ -509,6 +509,7 @@ static int nvgpu_gmmu_do_update_page_table(struct vm_gk20a *vm,
{
struct gk20a *g = gk20a_from_vm(vm);
struct nvgpu_sgl *sgl;
bool is_iommuable, sgt_is_iommuable;
int err = 0;
if (sgt == NULL) {
@@ -540,9 +541,10 @@ static int nvgpu_gmmu_do_update_page_table(struct vm_gk20a *vm,
* for (2), (3) and (4) we have to actually go through each SG entry and
* map each chunk individually.
*/
is_iommuable = nvgpu_iommuable(g);
sgt_is_iommuable = nvgpu_sgt_iommuable(g, sgt);
if (nvgpu_aperture_is_sysmem(attrs->aperture) &&
nvgpu_iommuable(g) &&
nvgpu_sgt_iommuable(g, sgt)) {
is_iommuable && sgt_is_iommuable) {
u64 io_addr = nvgpu_sgt_get_gpu_addr(g, sgt, sgt->sgl, attrs);
io_addr += space_to_skip;