Commit b001965d authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher

drm/amd/display: Fix use before NULL check in validate_timing

Found by smatch:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_timing_generator.c:1124
dce110_timing_generator_validate_timing() warn: variable dereferenced
before check 'timing' (see line 1116)
Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a8f97647
...@@ -1112,10 +1112,7 @@ bool dce110_timing_generator_validate_timing( ...@@ -1112,10 +1112,7 @@ bool dce110_timing_generator_validate_timing(
enum signal_type signal) enum signal_type signal)
{ {
uint32_t h_blank; uint32_t h_blank;
uint32_t h_back_porch; uint32_t h_back_porch, hsync_offset, h_sync_start;
uint32_t hsync_offset = timing->h_border_right +
timing->h_front_porch;
uint32_t h_sync_start = timing->h_addressable + hsync_offset;
struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg); struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
...@@ -1124,6 +1121,9 @@ bool dce110_timing_generator_validate_timing( ...@@ -1124,6 +1121,9 @@ bool dce110_timing_generator_validate_timing(
if (!timing) if (!timing)
return false; return false;
hsync_offset = timing->h_border_right + timing->h_front_porch;
h_sync_start = timing->h_addressable + hsync_offset;
/* Currently we don't support 3D, so block all 3D timings */ /* Currently we don't support 3D, so block all 3D timings */
if (timing->timing_3d_format != TIMING_3D_FORMAT_NONE) if (timing->timing_3d_format != TIMING_3D_FORMAT_NONE)
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment