aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_sdvo.c
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2013-07-12 11:24:40 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-07-12 11:33:21 -0400
commit53b914084950e5766b40228c4e08706e28745fa5 (patch)
tree70d1d2315bc66e6a177489cc6acb674779539465 /drivers/gpu/drm/i915/intel_sdvo.c
parent08e2a7de8ec86054a1272e4fc9d15fa6c18d3b16 (diff)
drm/i915: Don't attempt to read an unitialized stack value
If intel_sdvo_get_value() fails here, val is unitialized and the cross check will compare the pipe config multiplier with a bogus value. Instead, only set encoder_pixel_multiplier when the sdvo command has been successful. The cross check will compare the pipe config value with 0 otherwise. v2: Do the cross check with the initial value of encoder_pixel_multiplier (0) if the sdvo command fails (and thus keep the warning) (Daniel Vetter) Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_sdvo.c')
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 8415d6a610dd..798df114cfd3 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1357,17 +1357,19 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
1357 } 1357 }
1358 1358
1359 /* Cross check the port pixel multiplier with the sdvo encoder state. */ 1359 /* Cross check the port pixel multiplier with the sdvo encoder state. */
1360 intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_CLOCK_RATE_MULT, &val, 1); 1360 if (intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_CLOCK_RATE_MULT,
1361 switch (val) { 1361 &val, 1)) {
1362 case SDVO_CLOCK_RATE_MULT_1X: 1362 switch (val) {
1363 encoder_pixel_multiplier = 1; 1363 case SDVO_CLOCK_RATE_MULT_1X:
1364 break; 1364 encoder_pixel_multiplier = 1;
1365 case SDVO_CLOCK_RATE_MULT_2X: 1365 break;
1366 encoder_pixel_multiplier = 2; 1366 case SDVO_CLOCK_RATE_MULT_2X:
1367 break; 1367 encoder_pixel_multiplier = 2;
1368 case SDVO_CLOCK_RATE_MULT_4X: 1368 break;
1369 encoder_pixel_multiplier = 4; 1369 case SDVO_CLOCK_RATE_MULT_4X:
1370 break; 1370 encoder_pixel_multiplier = 4;
1371 break;
1372 }
1371 } 1373 }
1372 1374
1373 WARN(encoder_pixel_multiplier != pipe_config->pixel_multiplier, 1375 WARN(encoder_pixel_multiplier != pipe_config->pixel_multiplier,