Commit 87886221 authored by Francisco Jerez's avatar Francisco Jerez Committed by Ben Skeggs

drm/nv04-nv40: Fix NULL dereference when we fail to find an LVDS native mode.

Reported-by: default avatarAlex Buell <alex.buell@munted.org.uk>
Signed-off-by: default avatarFrancisco Jerez <currojerez@riseup.net>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 812f219a
...@@ -342,8 +342,8 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder, ...@@ -342,8 +342,8 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder,
if (nv_encoder->dcb->type == OUTPUT_LVDS) { if (nv_encoder->dcb->type == OUTPUT_LVDS) {
bool duallink, dummy; bool duallink, dummy;
nouveau_bios_parse_lvds_table(dev, nv_connector->native_mode-> nouveau_bios_parse_lvds_table(dev, output_mode->clock,
clock, &duallink, &dummy); &duallink, &dummy);
if (duallink) if (duallink)
regp->fp_control |= (8 << 28); regp->fp_control |= (8 << 28);
} else } else
...@@ -518,8 +518,6 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode) ...@@ -518,8 +518,6 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode)
return; return;
if (nv_encoder->dcb->lvdsconf.use_power_scripts) { if (nv_encoder->dcb->lvdsconf.use_power_scripts) {
struct nouveau_connector *nv_connector = nouveau_encoder_connector_get(nv_encoder);
/* when removing an output, crtc may not be set, but PANEL_OFF /* when removing an output, crtc may not be set, but PANEL_OFF
* must still be run * must still be run
*/ */
...@@ -527,12 +525,8 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode) ...@@ -527,12 +525,8 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode)
nv04_dfp_get_bound_head(dev, nv_encoder->dcb); nv04_dfp_get_bound_head(dev, nv_encoder->dcb);
if (mode == DRM_MODE_DPMS_ON) { if (mode == DRM_MODE_DPMS_ON) {
if (!nv_connector->native_mode) {
NV_ERROR(dev, "Not turning on LVDS without native mode\n");
return;
}
call_lvds_script(dev, nv_encoder->dcb, head, call_lvds_script(dev, nv_encoder->dcb, head,
LVDS_PANEL_ON, nv_connector->native_mode->clock); LVDS_PANEL_ON, nv_encoder->mode.clock);
} else } else
/* pxclk of 0 is fine for PANEL_OFF, and for a /* pxclk of 0 is fine for PANEL_OFF, and for a
* disconnected LVDS encoder there is no native_mode * disconnected LVDS encoder there is no native_mode
......
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