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 <vinceh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2770727
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Vince Hsu
2022-09-02 08:43:43 +00:00
committed by mobile promotions
parent 26e325aaf2
commit db637cd585

View File

@@ -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 * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * 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) int test_gk20a_get_pde_pgsz(struct unit_module *m, struct gk20a *g, void *args)
{ {
struct gk20a_mmu_level l; struct gk20a_mmu_level l = { 0 };
struct nvgpu_gmmu_pd pd; struct nvgpu_gmmu_pd pd = { 0 };
u32 ret_pgsz; u32 ret_pgsz;
int ret = UNIT_FAIL; int ret = UNIT_FAIL;
@@ -55,8 +55,8 @@ done:
int test_gk20a_get_pte_pgsz(struct unit_module *m, struct gk20a *g, void *args) int test_gk20a_get_pte_pgsz(struct unit_module *m, struct gk20a *g, void *args)
{ {
struct gk20a_mmu_level l; struct gk20a_mmu_level l = { 0 };
struct nvgpu_gmmu_pd pd; struct nvgpu_gmmu_pd pd = { 0 };
u32 ret_pgsz; u32 ret_pgsz;
int ret = UNIT_FAIL; int ret = UNIT_FAIL;