Commit 53b91408 authored by Damien Lespiau's avatar Damien Lespiau Committed by Daniel Vetter

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: default avatarDamien Lespiau <damien.lespiau@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 08e2a7de
...@@ -1357,7 +1357,8 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder, ...@@ -1357,7 +1357,8 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
} }
/* Cross check the port pixel multiplier with the sdvo encoder state. */ /* Cross check the port pixel multiplier with the sdvo encoder state. */
intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_CLOCK_RATE_MULT, &val, 1); if (intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_CLOCK_RATE_MULT,
&val, 1)) {
switch (val) { switch (val) {
case SDVO_CLOCK_RATE_MULT_1X: case SDVO_CLOCK_RATE_MULT_1X:
encoder_pixel_multiplier = 1; encoder_pixel_multiplier = 1;
...@@ -1369,6 +1370,7 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder, ...@@ -1369,6 +1370,7 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
encoder_pixel_multiplier = 4; encoder_pixel_multiplier = 4;
break; break;
} }
}
WARN(encoder_pixel_multiplier != pipe_config->pixel_multiplier, WARN(encoder_pixel_multiplier != pipe_config->pixel_multiplier,
"SDVO pixel multiplier mismatch, port: %i, encoder: %i\n", "SDVO pixel multiplier mismatch, port: %i, encoder: %i\n",
......
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