Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Fix uninitialized variables in DC

This fixes 49 UNINIT issues reported by Coverity.

Reviewed-by: Hersen Wu <hersenxs.wu@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Alex Hung and committed by
Alex Deucher
ba3193fa f95bcb04

+39 -39
+2 -2
drivers/gpu/drm/amd/display/dc/core/dc.c
··· 1306 1306 1307 1307 if (link != NULL && link->link_enc->funcs->is_dig_enabled(link->link_enc)) { 1308 1308 unsigned int enc_inst, tg_inst = 0; 1309 - unsigned int pix_clk_100hz; 1309 + unsigned int pix_clk_100hz = 0; 1310 1310 1311 1311 enc_inst = link->link_enc->funcs->get_dig_frontend(link->link_enc); 1312 1312 if (enc_inst != ENGINE_ID_UNKNOWN) { ··· 1793 1793 return false; 1794 1794 1795 1795 if (dc_is_dp_signal(link->connector_signal)) { 1796 - unsigned int pix_clk_100hz; 1796 + unsigned int pix_clk_100hz = 0; 1797 1797 uint32_t numOdmPipes = 1; 1798 1798 uint32_t id_src[4] = {0}; 1799 1799
+1 -1
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
··· 3042 3042 int i; 3043 3043 int dpp_pipe_count; 3044 3044 int cur_slice_count; 3045 - struct pipe_ctx *dpp_pipes[MAX_PIPES]; 3045 + struct pipe_ctx *dpp_pipes[MAX_PIPES] = {0}; 3046 3046 bool result = true; 3047 3047 3048 3048 dpp_pipe_count = resource_get_dpp_pipes_for_plane(plane,
+1 -1
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_mpc.c
··· 1183 1183 struct mpc_grph_gamut_adjustment *adjust) 1184 1184 { 1185 1185 struct dcn30_mpc *mpc30 = TO_DCN30_MPC(mpc); 1186 - uint16_t arr_reg_val[12]; 1186 + uint16_t arr_reg_val[12] = {0}; 1187 1187 int select; 1188 1188 1189 1189 read_gamut_remap(mpc30, mpcc_id, arr_reg_val, &select);
+1 -1
drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
··· 864 864 struct dc_state *state, 865 865 const struct dc_plane_state *plane) 866 866 { 867 - struct pipe_ctx *dpp_pipes[MAX_PIPES]; 867 + struct pipe_ctx *dpp_pipes[MAX_PIPES] = {0}; 868 868 int dpp_pipe_count = ctx->config.callbacks.get_dpp_pipes_for_plane(plane, 869 869 &state->res_ctx, dpp_pipes); 870 870
+1 -1
drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp_cm.c
··· 234 234 struct dpp_grph_csc_adjustment *adjust) 235 235 { 236 236 struct dcn10_dpp *dpp = TO_DCN10_DPP(dpp_base); 237 - uint16_t arr_reg_val[12]; 237 + uint16_t arr_reg_val[12] = {0}; 238 238 enum gamut_remap_select select; 239 239 240 240 read_gamut_remap(dpp, arr_reg_val, &select);
+1 -1
drivers/gpu/drm/amd/display/dc/dpp/dcn20/dcn20_dpp_cm.c
··· 274 274 struct dpp_grph_csc_adjustment *adjust) 275 275 { 276 276 struct dcn20_dpp *dpp = TO_DCN20_DPP(dpp_base); 277 - uint16_t arr_reg_val[12]; 277 + uint16_t arr_reg_val[12] = {0}; 278 278 enum dcn20_gamut_remap_select select; 279 279 280 280 read_gamut_remap(dpp, arr_reg_val, &select);
+1 -1
drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c
··· 445 445 struct dpp_grph_csc_adjustment *adjust) 446 446 { 447 447 struct dcn3_dpp *dpp = TO_DCN30_DPP(dpp_base); 448 - uint16_t arr_reg_val[12]; 448 + uint16_t arr_reg_val[12] = {0}; 449 449 int select; 450 450 451 451 read_gamut_remap(dpp, arr_reg_val, &select);
+3 -3
drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
··· 128 128 uint32_t offset, 129 129 uint32_t mask) 130 130 { 131 - enum gpio_id id; 131 + enum gpio_id id = 0; 132 132 uint32_t en; 133 133 134 134 if (!service->translate.funcs->offset_to_id(offset, mask, &id, &en)) { ··· 144 144 uint32_t offset, 145 145 uint32_t mask) 146 146 { 147 - enum gpio_id id; 147 + enum gpio_id id = 0; 148 148 uint32_t en; 149 149 struct gpio *generic; 150 150 ··· 178 178 enum gpio_id id, 179 179 uint32_t en) 180 180 { 181 - struct gpio_pin_info pin; 181 + struct gpio_pin_info pin = {0}; 182 182 183 183 if (service->translate.funcs->id_to_offset) { 184 184 service->translate.funcs->id_to_offset(id, en, &pin);
+2 -2
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
··· 1537 1537 } 1538 1538 1539 1539 if (pipe_ctx->stream_res.audio != NULL) { 1540 - struct audio_output audio_output; 1540 + struct audio_output audio_output = {0}; 1541 1541 1542 1542 build_audio_output(context, pipe_ctx, &audio_output); 1543 1543 ··· 2260 2260 continue; 2261 2261 2262 2262 if (pipe_ctx->stream_res.audio != NULL) { 2263 - struct audio_output audio_output; 2263 + struct audio_output audio_output = {0}; 2264 2264 2265 2265 build_audio_output(context, pipe_ctx, &audio_output); 2266 2266
+3 -3
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c
··· 2185 2185 struct dc_crtc_timing *hw_crtc_timing; 2186 2186 uint64_t phase[MAX_PIPES]; 2187 2187 uint64_t modulo[MAX_PIPES]; 2188 - unsigned int pclk; 2188 + unsigned int pclk = 0; 2189 2189 2190 2190 uint32_t embedded_pix_clk_100hz; 2191 2191 uint16_t embedded_h_total; ··· 2276 2276 struct dc_context *dc_ctx = dc->ctx; 2277 2277 struct output_pixel_processor *opp; 2278 2278 struct timing_generator *tg; 2279 - int i, width, height, master; 2279 + int i, width = 0, height = 0, master; 2280 2280 2281 2281 DC_LOGGER_INIT(dc_ctx->logger); 2282 2282 ··· 2342 2342 struct dc_context *dc_ctx = dc->ctx; 2343 2343 struct output_pixel_processor *opp; 2344 2344 struct timing_generator *tg; 2345 - int i, width, height; 2345 + int i, width = 0, height = 0; 2346 2346 2347 2347 DC_LOGGER_INIT(dc_ctx->logger); 2348 2348
+1 -1
drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_hwseq.c
··· 167 167 struct tg_color black_color = {0}; 168 168 struct output_pixel_processor *opp = NULL; 169 169 uint32_t num_opps, opp_id_src0, opp_id_src1; 170 - uint32_t otg_active_width, otg_active_height; 170 + uint32_t otg_active_width = 0, otg_active_height = 0; 171 171 172 172 /* program opp dpg blank color */ 173 173 color_space = COLOR_SPACE_SRGB;
+1 -1
drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c
··· 66 66 67 67 int dcn21_init_sys_ctx(struct dce_hwseq *hws, struct dc *dc, struct dc_phy_addr_space_config *pa_config) 68 68 { 69 - struct dcn_hubbub_phys_addr_config config; 69 + struct dcn_hubbub_phys_addr_config config = {0}; 70 70 71 71 config.system_aperture.fb_top = pa_config->system_aperture.fb_top; 72 72 config.system_aperture.fb_offset = pa_config->system_aperture.fb_offset;
+1 -1
drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c
··· 479 479 480 480 int dcn31_init_sys_ctx(struct dce_hwseq *hws, struct dc *dc, struct dc_phy_addr_space_config *pa_config) 481 481 { 482 - struct dcn_hubbub_phys_addr_config config; 482 + struct dcn_hubbub_phys_addr_config config = {0}; 483 483 484 484 config.system_aperture.fb_top = pa_config->system_aperture.fb_top; 485 485 config.system_aperture.fb_offset = pa_config->system_aperture.fb_offset;