From db637cd585e82b32e9169150c87ebc5d62f56567 Mon Sep 17 00:00:00 2001 From: Vince Hsu Date: Fri, 2 Sep 2022 08:43:43 +0000 Subject: [PATCH] gpu: nvgpu: unit: mm: fix compilation error with GCC 11.2 The maybe-uninitialized in GCC 11.2 reports the error below: error: 'l' may be used uninitialized [-Werror=maybe-uninitialized] Fix it by explicitly initialize the struct as zero. Bug 200730650 Change-Id: I5cc279e80fb8d2eb7839888da94a4336588f0324 Signed-off-by: Vince Hsu Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2770727 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Alex Waterman GVS: Gerrit_Virtual_Submit --- .../mm/hal/gmmu/gmmu_gk20a_fusa/gmmu-gk20a-fusa.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/userspace/units/mm/hal/gmmu/gmmu_gk20a_fusa/gmmu-gk20a-fusa.c b/userspace/units/mm/hal/gmmu/gmmu_gk20a_fusa/gmmu-gk20a-fusa.c index a2ab962fb..274b4ee21 100644 --- a/userspace/units/mm/hal/gmmu/gmmu_gk20a_fusa/gmmu-gk20a-fusa.c +++ b/userspace/units/mm/hal/gmmu/gmmu_gk20a_fusa/gmmu-gk20a-fusa.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -34,8 +34,8 @@ int test_gk20a_get_pde_pgsz(struct unit_module *m, struct gk20a *g, void *args) { - struct gk20a_mmu_level l; - struct nvgpu_gmmu_pd pd; + struct gk20a_mmu_level l = { 0 }; + struct nvgpu_gmmu_pd pd = { 0 }; u32 ret_pgsz; int ret = UNIT_FAIL; @@ -55,8 +55,8 @@ done: int test_gk20a_get_pte_pgsz(struct unit_module *m, struct gk20a *g, void *args) { - struct gk20a_mmu_level l; - struct nvgpu_gmmu_pd pd; + struct gk20a_mmu_level l = { 0 }; + struct nvgpu_gmmu_pd pd = { 0 }; u32 ret_pgsz; int ret = UNIT_FAIL;