[PATCH 29/38] drm/amd/display: Fix maybe-uninitialized warning

Bhawanpreet Lakha Bhawanpreet.Lakha at amd.com
Wed Oct 2 18:16:24 UTC 2019


From: Leo Li <sunpeng.li at amd.com>

[Why]

Compiling with GCC 9.1.0 gives the following warning (I have
warnings-as-errors enabled):

drivers/gpu/drm/amd/amdgpu/../dal-dev/dc/core/dc.c: In function 'dc_validate_seamless_boot_timing':
drivers/gpu/drm/amd/amdgpu/../dal-dev/dc/core/dc.c:1180:8: error: 'se' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1180 |   if (!se->funcs->dp_get_pixel_format(
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1181 |    se,
      |    ~~~
 1182 |    &hw_crtc_timing.pixel_encoding,
      |    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1183 |    &hw_crtc_timing.display_color_depth))

[How]

Initialize se to NULL.

Change-Id: I79d89ea518f862a9479581529dbbe8977e224ce2
Signed-off-by: Leo Li <sunpeng.li at amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland at amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha at amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 3416c8bd09ae..824c0d3b2100 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1004,7 +1004,7 @@ bool dc_validate_seamless_boot_timing(const struct dc *dc,
 				struct dc_crtc_timing *crtc_timing)
 {
 	struct timing_generator *tg;
-	struct stream_encoder *se;
+	struct stream_encoder *se = NULL;
 
 	struct dc_crtc_timing hw_crtc_timing = {0};
 
-- 
2.17.1



More information about the amd-gfx mailing list