From cd3ad1ccc7d84ed7dc659d4037236e4c49b34d7d Mon Sep 17 00:00:00 2001 From: scottl Date: Fri, 2 Jul 2021 11:54:53 -0700 Subject: [PATCH] gpu: nvgpu: fix REMAP android build failure Rework nvgpu_vm_remap_os_buf structure initialization to avoid android/clang build issues with the use of a single pair of {} to initialize certain structures. The os-dependent nvgpu_vm_remap_os_buf_get() routine now does a memset of the structure prior to initializing its contents. Jira NVGPU-6804 Change-Id: I08682c6ab7b8324a605a56ed660dea5bea11d16b Signed-off-by: scottl Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2553193 Tested-by: mobile promotions Reviewed-by: svcacv Reviewed-by: svc_kernel_abi Reviewed-by: Alex Waterman Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/mm/vm_remap.c | 2 +- drivers/gpu/nvgpu/os/linux/vm_remap.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/common/mm/vm_remap.c b/drivers/gpu/nvgpu/common/mm/vm_remap.c index 48d61dec2..ccd729ea8 100644 --- a/drivers/gpu/nvgpu/common/mm/vm_remap.c +++ b/drivers/gpu/nvgpu/common/mm/vm_remap.c @@ -544,7 +544,7 @@ static int nvgpu_vm_remap_get_mpool(struct vm_gk20a *vm, struct nvgpu_vm_remap_mpool **curr_mpool, u32 *curr_mem_handle) { - struct nvgpu_vm_remap_os_buffer remap_os_buf = { 0 }; + struct nvgpu_vm_remap_os_buffer remap_os_buf; int err = 0; if (op->mem_handle == *curr_mem_handle) { diff --git a/drivers/gpu/nvgpu/os/linux/vm_remap.c b/drivers/gpu/nvgpu/os/linux/vm_remap.c index 7925841ef..dded7e673 100644 --- a/drivers/gpu/nvgpu/os/linux/vm_remap.c +++ b/drivers/gpu/nvgpu/os/linux/vm_remap.c @@ -100,6 +100,8 @@ int nvgpu_vm_remap_os_buf_get(struct vm_gk20a *vm, goto clean_up; } + memset(remap_os_buf, 0, sizeof(*remap_os_buf)); + remap_os_buf->os_priv.dmabuf = dmabuf; remap_os_buf->os_priv.attachment = attachment; remap_os_buf->os_priv.sgt = sgt;