mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
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:
committed by
mobile promotions
parent
40d9609eff
commit
f8f9dfeea8
@@ -509,6 +509,7 @@ static int nvgpu_gmmu_do_update_page_table(struct vm_gk20a *vm,
|
|||||||
{
|
{
|
||||||
struct gk20a *g = gk20a_from_vm(vm);
|
struct gk20a *g = gk20a_from_vm(vm);
|
||||||
struct nvgpu_sgl *sgl;
|
struct nvgpu_sgl *sgl;
|
||||||
|
bool is_iommuable, sgt_is_iommuable;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (sgt == NULL) {
|
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
|
* for (2), (3) and (4) we have to actually go through each SG entry and
|
||||||
* map each chunk individually.
|
* map each chunk individually.
|
||||||
*/
|
*/
|
||||||
|
is_iommuable = nvgpu_iommuable(g);
|
||||||
|
sgt_is_iommuable = nvgpu_sgt_iommuable(g, sgt);
|
||||||
if (nvgpu_aperture_is_sysmem(attrs->aperture) &&
|
if (nvgpu_aperture_is_sysmem(attrs->aperture) &&
|
||||||
nvgpu_iommuable(g) &&
|
is_iommuable && sgt_is_iommuable) {
|
||||||
nvgpu_sgt_iommuable(g, sgt)) {
|
|
||||||
u64 io_addr = nvgpu_sgt_get_gpu_addr(g, sgt, sgt->sgl, attrs);
|
u64 io_addr = nvgpu_sgt_get_gpu_addr(g, sgt, sgt->sgl, attrs);
|
||||||
|
|
||||||
io_addr += space_to_skip;
|
io_addr += space_to_skip;
|
||||||
|
|||||||
Reference in New Issue
Block a user