diff options
author | Harry Wentland <harry.wentland@amd.com> | 2017-11-10 12:11:44 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-11-28 17:56:19 -0500 |
commit | b001965d4eb5e4c0e3de7dc6dce1d45ca25232a7 (patch) | |
tree | 17dc9a67a157a772f7fd9d4845dc5d20978475ca | |
parent | a8f9764731968d6a63f6f98c5b0d4e7a0e4154e2 (diff) |
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: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c index 67ac737eaa7e..4befce6cd87a 100644 --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c | |||
@@ -1112,10 +1112,7 @@ bool dce110_timing_generator_validate_timing( | |||
1112 | enum signal_type signal) | 1112 | enum signal_type signal) |
1113 | { | 1113 | { |
1114 | uint32_t h_blank; | 1114 | uint32_t h_blank; |
1115 | uint32_t h_back_porch; | 1115 | uint32_t h_back_porch, hsync_offset, h_sync_start; |
1116 | uint32_t hsync_offset = timing->h_border_right + | ||
1117 | timing->h_front_porch; | ||
1118 | uint32_t h_sync_start = timing->h_addressable + hsync_offset; | ||
1119 | 1116 | ||
1120 | struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg); | 1117 | struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg); |
1121 | 1118 | ||
@@ -1124,6 +1121,9 @@ bool dce110_timing_generator_validate_timing( | |||
1124 | if (!timing) | 1121 | if (!timing) |
1125 | return false; | 1122 | return false; |
1126 | 1123 | ||
1124 | hsync_offset = timing->h_border_right + timing->h_front_porch; | ||
1125 | h_sync_start = timing->h_addressable + hsync_offset; | ||
1126 | |||
1127 | /* Currently we don't support 3D, so block all 3D timings */ | 1127 | /* Currently we don't support 3D, so block all 3D timings */ |
1128 | if (timing->timing_3d_format != TIMING_3D_FORMAT_NONE) | 1128 | if (timing->timing_3d_format != TIMING_3D_FORMAT_NONE) |
1129 | return false; | 1129 | return false; |