All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wayne Lin <Wayne.Lin@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Harry.Wentland@amd.com>, <Sunpeng.Li@amd.com>,
	<Rodrigo.Siqueira@amd.com>, <Aurabindo.Pillai@amd.com>,
	<roman.li@amd.com>, <wayne.lin@amd.com>,
	<agustin.gutierrez@amd.com>, <chiahsuan.chung@amd.com>,
	<hersenxs.wu@amd.com>, <jerry.zuo@amd.com>,
	Alex Hung <alex.hung@amd.com>
Subject: [PATCH 44/46] drm/amd/display: Fix uninitialized variables in DC
Date: Wed, 24 Apr 2024 16:49:29 +0800	[thread overview]
Message-ID: <20240424084931.2656128-45-Wayne.Lin@amd.com> (raw)
In-Reply-To: <20240424084931.2656128-1-Wayne.Lin@amd.com>

From: Alex Hung <alex.hung@amd.com>

This fixes 29 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>
---
 drivers/gpu/drm/amd/display/dc/bios/command_table.c           | 2 +-
 drivers/gpu/drm/amd/display/dc/bios/command_table2.c          | 2 +-
 drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c          | 4 ++--
 drivers/gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c          | 2 +-
 drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c          | 2 +-
 .../drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c   | 4 ++--
 drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c | 4 ++--
 drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c       | 2 +-
 drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c     | 2 +-
 drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c       | 4 ++--
 drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c       | 2 +-
 drivers/gpu/drm/amd/display/dc/link/link_detection.c          | 4 ++--
 .../gpu/drm/amd/display/dc/link/protocols/link_dp_training.c  | 2 +-
 .../gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c  | 2 +-
 14 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/bios/command_table.c b/drivers/gpu/drm/amd/display/dc/bios/command_table.c
index 86f9198e7501..2bcae0643e61 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/command_table.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/command_table.c
@@ -399,7 +399,7 @@ static enum bp_result transmitter_control_v1_6(
 static void init_transmitter_control(struct bios_parser *bp)
 {
 	uint8_t frev;
-	uint8_t crev;
+	uint8_t crev = 0;
 
 	if (BIOS_CMD_TABLE_REVISION(UNIPHYTransmitterControl,
 			frev, crev) == false)
diff --git a/drivers/gpu/drm/amd/display/dc/bios/command_table2.c b/drivers/gpu/drm/amd/display/dc/bios/command_table2.c
index cbae1be7b009..cc000833d300 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/command_table2.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/command_table2.c
@@ -225,7 +225,7 @@ static enum bp_result transmitter_control_fallback(
 static void init_transmitter_control(struct bios_parser *bp)
 {
 	uint8_t frev;
-	uint8_t crev;
+	uint8_t crev = 0;
 
 	BIOS_CMD_TABLE_REVISION(dig1transmittercontrol, frev, crev);
 
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c
index 25d46c69464f..74da9ebda016 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c
@@ -2372,7 +2372,7 @@ bool dcn21_validate_bandwidth_fp(struct dc *dc, struct dc_state *context,
 
 static struct _vcs_dpi_voltage_scaling_st construct_low_pstate_lvl(struct clk_limit_table *clk_table, unsigned int high_voltage_lvl)
 {
-	struct _vcs_dpi_voltage_scaling_st low_pstate_lvl;
+	struct _vcs_dpi_voltage_scaling_st low_pstate_lvl = {0};
 	int i;
 
 	low_pstate_lvl.state = 1;
@@ -2477,7 +2477,7 @@ void dcn201_populate_dml_writeback_from_context_fpu(struct dc *dc,
 	int pipe_cnt, i, j;
 	double max_calc_writeback_dispclk;
 	double writeback_dispclk;
-	struct writeback_st dout_wb;
+	struct writeback_st dout_wb = {0};
 
 	dc_assert_fp_enabled();
 
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c
index ccb4ad78f667..81f7b90849ce 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c
@@ -260,7 +260,7 @@ void dcn30_fpu_populate_dml_writeback_from_context(
 	int pipe_cnt, i, j;
 	double max_calc_writeback_dispclk;
 	double writeback_dispclk;
-	struct writeback_st dout_wb;
+	struct writeback_st dout_wb = {0};
 
 	dc_assert_fp_enabled();
 
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
index 8912475f01e2..d74f51efb703 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
@@ -723,7 +723,7 @@ static bool dcn32_enough_pipes_for_subvp(struct dc *dc, struct dc_state *context
  */
 static bool subvp_subvp_schedulable(struct dc *dc, struct dc_state *context)
 {
-	struct pipe_ctx *subvp_pipes[2];
+	struct pipe_ctx *subvp_pipes[2] = {0};
 	struct dc_stream_state *phantom = NULL;
 	uint32_t microschedule_lines = 0;
 	uint32_t index = 0;
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
index 76399c66bc3b..ba1310c8fd77 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
@@ -1973,8 +1973,8 @@ void dml32_CalculateVMRowAndSwath(
 	unsigned int PTEBufferSizeInRequestsForChroma[DC__NUM_DPP__MAX];
 	unsigned int PDEAndMetaPTEBytesFrameY;
 	unsigned int PDEAndMetaPTEBytesFrameC;
-	unsigned int MetaRowByteY[DC__NUM_DPP__MAX];
-	unsigned int MetaRowByteC[DC__NUM_DPP__MAX];
+	unsigned int MetaRowByteY[DC__NUM_DPP__MAX] = {0};
+	unsigned int MetaRowByteC[DC__NUM_DPP__MAX] = {0};
 	unsigned int PixelPTEBytesPerRowY[DC__NUM_DPP__MAX];
 	unsigned int PixelPTEBytesPerRowC[DC__NUM_DPP__MAX];
 	unsigned int PixelPTEBytesPerRowY_one_row_per_frame[DC__NUM_DPP__MAX];
diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c
index f00526d04cb7..705985d3f407 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c
@@ -326,8 +326,8 @@ void dml2_init_soc_states(struct dml2_context *dml2, const struct dc *in_dc,
 {
 	struct dml2_policy_build_synthetic_soc_states_scratch *s = &dml2->v20.scratch.create_scratch.build_synthetic_socbb_scratch;
 	struct dml2_policy_build_synthetic_soc_states_params *p = &dml2->v20.scratch.build_synthetic_socbb_params;
-	unsigned int dcfclk_stas_mhz[NUM_DCFCLK_STAS];
-	unsigned int dcfclk_stas_mhz_new[NUM_DCFCLK_STAS_NEW];
+	unsigned int dcfclk_stas_mhz[NUM_DCFCLK_STAS] = {0};
+	unsigned int dcfclk_stas_mhz_new[NUM_DCFCLK_STAS_NEW] = {0};
 	unsigned int dml_project = dml2->v20.dml_core_ctx.project;
 
 	unsigned int i = 0;
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c
index e0cc78e899bd..4a37f13cbd62 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c
@@ -403,7 +403,7 @@ void dcn20_init_blank(
 	struct output_pixel_processor *opp = NULL;
 	struct output_pixel_processor *bottom_opp = NULL;
 	uint32_t num_opps, opp_id_src0, opp_id_src1;
-	uint32_t otg_active_width, otg_active_height;
+	uint32_t otg_active_width = 0, otg_active_height = 0;
 
 	/* program opp dpg blank color */
 	color_space = COLOR_SPACE_SRGB;
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c
index 06b70c360ff8..0c994b5a48b1 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c
@@ -82,7 +82,7 @@ static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
 
 	if (enable) {
 		struct dsc_config dsc_cfg;
-		struct dsc_optc_config dsc_optc_cfg;
+		struct dsc_optc_config dsc_optc_cfg = {0};
 		enum optc_dsc_mode optc_dsc_mode;
 
 		/* Enable DSC hw block */
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
index 5bc4d9b2cf79..4302f9be1a7d 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
@@ -1005,7 +1005,7 @@ static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
 
 	if (enable) {
 		struct dsc_config dsc_cfg;
-		struct dsc_optc_config dsc_optc_cfg;
+		struct dsc_optc_config dsc_optc_cfg = {0};
 		enum optc_dsc_mode optc_dsc_mode;
 
 		/* Enable DSC hw block */
@@ -1558,7 +1558,7 @@ void dcn32_init_blank(
 	struct output_pixel_processor *opp = NULL;
 	struct output_pixel_processor *bottom_opp = NULL;
 	uint32_t num_opps, opp_id_src0, opp_id_src1;
-	uint32_t otg_active_width, otg_active_height;
+	uint32_t otg_active_width = 0, otg_active_height = 0;
 	uint32_t i;
 
 	/* program opp dpg blank color */
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c
index dea7e63a49d9..a39a219a0bce 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c
@@ -373,7 +373,7 @@ static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
 
 	if (enable) {
 		struct dsc_config dsc_cfg;
-		struct dsc_optc_config dsc_optc_cfg;
+		struct dsc_optc_config dsc_optc_cfg = {0};
 		enum optc_dsc_mode optc_dsc_mode;
 
 		/* Enable DSC hw block */
diff --git a/drivers/gpu/drm/amd/display/dc/link/link_detection.c b/drivers/gpu/drm/amd/display/dc/link/link_detection.c
index fd9c1311c2fa..bba644024780 100644
--- a/drivers/gpu/drm/amd/display/dc/link/link_detection.c
+++ b/drivers/gpu/drm/amd/display/dc/link/link_detection.c
@@ -516,8 +516,8 @@ static void query_hdcp_capability(enum signal_type signal, struct dc_link *link)
 static void read_current_link_settings_on_detect(struct dc_link *link)
 {
 	union lane_count_set lane_count_set = {0};
-	uint8_t link_bw_set;
-	uint8_t link_rate_set;
+	uint8_t link_bw_set = 0;
+	uint8_t link_rate_set = 0;
 	uint32_t read_dpcd_retry_cnt = 10;
 	enum dc_status status = DC_ERROR_UNEXPECTED;
 	int i;
diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c
index 9de5380757e0..1818970b8eaf 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c
@@ -1071,7 +1071,7 @@ enum dc_status dpcd_set_link_settings(
 		 * MUX chip gets link rate set back before link training.
 		 */
 		if (link->connector_signal == SIGNAL_TYPE_EDP) {
-			uint8_t supported_link_rates[16];
+			uint8_t supported_link_rates[16] = {0};
 
 			core_link_read_dpcd(link, DP_SUPPORTED_LINK_RATES,
 					supported_link_rates, sizeof(supported_link_rates));
diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c
index d2bc66904217..63f0f882c861 100644
--- a/drivers/gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c
@@ -1144,7 +1144,7 @@ static bool dcn303_resource_construct(
 	int i;
 	struct dc_context *ctx = dc->ctx;
 	struct irq_service_init_data init_data;
-	struct ddc_service_init_data ddc_init_data;
+	struct ddc_service_init_data ddc_init_data = {0};
 
 	ctx->dc_bios->regs = &bios_regs;
 
-- 
2.37.3


  parent reply	other threads:[~2024-04-24  8:54 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24  8:48 [PATCH 00/46] DC Patches April 29, 2024 Wayne Lin
2024-04-24  8:48 ` [PATCH 01/46] drm/amd/display: Do cursor programming with rest of pipe Wayne Lin
2024-04-24  8:48 ` [PATCH 02/46] drm/amd/display: Always use legacy way of setting cursor on DCE Wayne Lin
2024-04-24  8:48 ` [PATCH 03/46] drm/amd/display: Add NULL pointer check for kzalloc Wayne Lin
2024-04-24  8:48 ` [PATCH 04/46] drm/amd/display: Check index msg_id before read or write Wayne Lin
2024-04-24  8:48 ` [PATCH 05/46] drm/amd/display: Check pipe offset before setting vblank Wayne Lin
2024-04-24  8:48 ` [PATCH 06/46] drm/amd/display: Skip finding free audio for unknown engine_id Wayne Lin
2024-04-24  8:48 ` [PATCH 07/46] drm/amd/display: Fix overlapping copy within dml_core_mode_programming Wayne Lin
2024-04-24  8:48 ` [PATCH 08/46] drm/amd/display: Do not return negative stream id for array Wayne Lin
2024-04-24  8:48 ` [PATCH 09/46] drm/amd/display: ASSERT when failing to find index by plane/stream id Wayne Lin
2024-04-24  8:48 ` [PATCH 10/46] drm/amd/display: Remove unnecessary files Wayne Lin
2024-04-24  8:48 ` [PATCH 11/46] drm/amd/display: Improve registers write Wayne Lin
2024-04-24  8:48 ` [PATCH 12/46] drm/amd/display: Add missing SMU version Wayne Lin
2024-04-24  8:48 ` [PATCH 13/46] drm/amd/display: Adjust codestyle for dcn31 and hdcp_msg Wayne Lin
2024-04-24  8:48 ` [PATCH 14/46] drm/amd/display: Add VCO speed parameter for DCN31 FPU Wayne Lin
2024-04-24  8:49 ` [PATCH 15/46] drm/amd/display: Adjust functions prefix for some of the dcn301 fpu functions Wayne Lin
2024-04-24  8:49 ` [PATCH 16/46] drm/amd/display: Enable legacy fast update for dcn301 Wayne Lin
2024-04-24  8:49 ` [PATCH 17/46] drm/amd/display: Update some of the dcn303 parameters Wayne Lin
2024-04-24  8:49 ` [PATCH 18/46] drm/amd/display: Remove legacy code in DC Wayne Lin
2024-04-24  8:49 ` [PATCH 19/46] drm/amd/display: Add log_color_state callback to multiple DCNs Wayne Lin
2024-04-24  8:49 ` [PATCH 20/46] drm/amd/display: Handle the case which quad_part is equal 0 Wayne Lin
2024-04-24  8:49 ` [PATCH 21/46] drm/amd/display: Refactor for Replay Link off frame count Wayne Lin
2024-04-24  8:49 ` [PATCH 22/46] drm/amd/display: Restrict multi-disp support for in-game FAMS Wayne Lin
2024-04-24  8:49 ` [PATCH 23/46] drm/amd/display: Defer handling mst up request in resume Wayne Lin
2024-04-24  8:49 ` [PATCH 24/46] drm/amd/display: Fix DC mode screen flickering on DCN321 Wayne Lin
2024-04-24  8:49 ` [PATCH 25/46] drm/amd/display: take ODM slice count into account when deciding DSC slice Wayne Lin
2024-04-24  8:49 ` [PATCH 26/46] drm/amd/display: Re-enable IPS2 for static screen Wayne Lin
2024-04-24  8:49 ` [PATCH 27/46] drm/amd/display: Add trigger FIFO resync path for DCN35 Wayne Lin
2024-04-24  8:49 ` [PATCH 28/46] drm/amd/display: Enable RCO for PHYSYMCLK in DCN35 Wayne Lin
2024-04-24 13:48   ` Li, Roman
2024-04-24  8:49 ` [PATCH 29/46] drm/amd/display: Revert "dc: Keep VBios pixel rate div setting util next mode set" Wayne Lin
2024-04-24  8:49 ` [PATCH 30/46] drm/amd/display: Only program P-State force if pipe config changed Wayne Lin
2024-04-24  8:49 ` [PATCH 31/46] drm/amd/display: Remove redundant include file Wayne Lin
2024-04-24  8:49 ` [PATCH 32/46] drm/amd/display: Refactor HUBBUB into component folder Wayne Lin
2024-04-24  8:49 ` [PATCH 33/46] drm/amd/display: Assign linear_pitch_alignment even for VM Wayne Lin
2024-04-24  8:49 ` [PATCH 34/46] drm/amd/display: gpuvm handling in DML21 Wayne Lin
2024-04-24  8:49 ` [PATCH 35/46] drm/amd/display: For FPO + Vactive check that all pipes support VA Wayne Lin
2024-04-24  8:49 ` [PATCH 36/46] drm/amd/display: Fix uninitialized variables in DM Wayne Lin
2024-04-24  8:49 ` [PATCH 37/46] drm/amd/display: Fix uninitialized variables in DC Wayne Lin
2024-04-24  8:49 ` [PATCH 38/46] drm/amd/display: Fix FEC_READY write on DP LT Wayne Lin
2024-04-24  8:49 ` [PATCH 39/46] drm/amd/display: use even ODM slice width for two pixels per container Wayne Lin
2024-04-24  8:49 ` [PATCH 40/46] drm/amd/display: Enable Replay for DCN315 Wayne Lin
2024-04-24  8:49 ` [PATCH 41/46] drm/amd/display: Notify idle link detection through shared state Wayne Lin
2024-04-24  8:49 ` [PATCH 42/46] drm/amd/display: Add periodic detection for IPS Wayne Lin
2024-04-24  8:49 ` [PATCH 43/46] drm/amd/display: Change ASSR disable sequence Wayne Lin
2024-04-24  8:49 ` Wayne Lin [this message]
2024-04-24  8:49 ` [PATCH 45/46] drm/amd/display: Disable seamless boot on 128b/132b encoding Wayne Lin
2024-04-24  8:49 ` [PATCH 46/46] drm/amd/display: 3.2.283 Wayne Lin
2024-04-29 13:17 ` [PATCH 00/46] DC Patches April 29, 2024 Wheeler, Daniel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240424084931.2656128-45-Wayne.Lin@amd.com \
    --to=wayne.lin@amd.com \
    --cc=Aurabindo.Pillai@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=agustin.gutierrez@amd.com \
    --cc=alex.hung@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=chiahsuan.chung@amd.com \
    --cc=hersenxs.wu@amd.com \
    --cc=jerry.zuo@amd.com \
    --cc=roman.li@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.