From 3569e21518f2e2493066fda007be4f15207b14ce Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Wed, 25 Mar 2020 10:40:00 -0700 Subject: [PATCH] gpu: nvgpu: unit: Several fixes for initializations Structs with structs inside them need to be initialized with double braces. Also add a couple of missing initializations. Change-Id: I0aa5f7ac008b8db4bececa92807f598f2f3081bd Signed-off-by: Terje Bergstrom Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2318387 Tested-by: mobile promotions Reviewed-by: mobile promotions --- userspace/units/fifo/channel/nvgpu-channel.c | 4 ++-- userspace/units/fifo/fifo/nvgpu-fifo.c | 6 +++--- userspace/units/rc/nvgpu-rc.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/userspace/units/fifo/channel/nvgpu-channel.c b/userspace/units/fifo/channel/nvgpu-channel.c index 37f146cf8..61866c764 100644 --- a/userspace/units/fifo/channel/nvgpu-channel.c +++ b/userspace/units/fifo/channel/nvgpu-channel.c @@ -424,9 +424,9 @@ static bool channel_close_pruned(u32 branches, u32 final) int test_channel_close(struct unit_module *m, struct gk20a *g, void *vargs) { struct gpu_ops gops = g->ops; - struct nvgpu_channel *ch; + struct nvgpu_channel *ch = NULL; struct nvgpu_tsg *tsg; - struct nvgpu_channel_sync user_sync = {0}; + struct nvgpu_channel_sync user_sync = { {0} }; u32 branches = 0U; int ret = UNIT_FAIL; u32 fail = F_CHANNEL_CLOSE_ALREADY_FREED | diff --git a/userspace/units/fifo/fifo/nvgpu-fifo.c b/userspace/units/fifo/fifo/nvgpu-fifo.c index 300061c20..46f51ac1c 100644 --- a/userspace/units/fifo/fifo/nvgpu-fifo.c +++ b/userspace/units/fifo/fifo/nvgpu-fifo.c @@ -111,7 +111,7 @@ static bool stub_mm_is_bar1_supported(struct gk20a *g) int test_fifo_suspend(struct unit_module *m, struct gk20a *g, void *args) { - struct gpu_ops gops; + struct gpu_ops gops = { {0} }; u32 reg0_val, reg1_val; u32 branches = 0U; int ret = UNIT_FAIL; @@ -163,7 +163,7 @@ done: int test_fifo_sw_quiesce(struct unit_module *m, struct gk20a *g, void *args) { - struct gpu_ops gops; + struct gpu_ops gops = { {0} }; u32 reg_val; int ret = UNIT_FAIL; int err; @@ -246,7 +246,7 @@ static int stub_init_fifo_setup_hw_pass(struct gk20a *g) int test_init_support(struct unit_module *m, struct gk20a *g, void *args) { struct nvgpu_posix_fault_inj *kmem_fi; - struct gpu_ops gops; + struct gpu_ops gops = { {0} }; u32 branches = 0U; int ret = UNIT_FAIL; diff --git a/userspace/units/rc/nvgpu-rc.c b/userspace/units/rc/nvgpu-rc.c index a8babd3a9..cd39ec434 100644 --- a/userspace/units/rc/nvgpu-rc.c +++ b/userspace/units/rc/nvgpu-rc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2020, 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"), @@ -424,7 +424,7 @@ int test_rc_pbdma_fault(struct unit_module *m, struct gk20a *g, void *args) for (id_type_branches = F_RC_ID_TYPE_TSG; id_type_branches <= F_RC_ID_TYPE_INVALID; id_type_branches++) { - u32 id_type_ch_sub_branches; + u32 id_type_ch_sub_branches = 0U; if (id_type_branches == F_RC_ID_TYPE_CH) { for (id_type_ch_sub_branches = F_RC_ID_TYPE_CH_NULL_CHANNEL; id_type_ch_sub_branches <= F_RC_ID_TYPE_CH_FULL; id_type_ch_sub_branches++) {