Message ID | 1364224574-22521-1-git-send-email-damien.lespiau@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi 2013/3/25 Damien Lespiau <damien.lespiau@intel.com>: > If TRANS_DDI_FUNC_CTL has been wrongly programmed with an incorrect > port, we are currently trying to read PORT_CLK_SEL(port) with an > uninitialized value. > > Handle that case by returning PORT_CLK_SEL_NONE and warning about it. > > v2: Move the warning inside intel_ddi_get_crtc_pll (Paulo Zanoni) > > Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> > --- > drivers/gpu/drm/i915/intel_ddi.c | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c > index d26147c..258e38e 100644 > --- a/drivers/gpu/drm/i915/intel_ddi.c > +++ b/drivers/gpu/drm/i915/intel_ddi.c > @@ -1160,7 +1160,7 @@ static uint32_t intel_ddi_get_crtc_pll(struct drm_i915_private *dev_priv, > enum pipe pipe) > { > uint32_t temp, ret; > - enum port port; > + enum port port = I915_MAX_PORTS; > enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, > pipe); > int i; > @@ -1176,10 +1176,16 @@ static uint32_t intel_ddi_get_crtc_pll(struct drm_i915_private *dev_priv, > port = i; > } > > - ret = I915_READ(PORT_CLK_SEL(port)); > - > - DRM_DEBUG_KMS("Pipe %c connected to port %c using clock 0x%08x\n", > - pipe_name(pipe), port_name(port), ret); > + if (port == I915_MAX_PORTS) { > + WARN(1, "Pipe %c enabled on an unknown port\n", > + pipe_name(pipe)); > + ret = PORT_CLK_SEL_NONE; > + } else { > + ret = I915_READ(PORT_CLK_SEL(port)); > + DRM_DEBUG_KMS("Pipe %c connected to port %c using clock " > + "0x%08x\n", pipe_name(pipe), port_name(port), > + ret); > + } > > return ret; > } > -- > 1.7.11.7 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
On Mon, Mar 25, 2013 at 02:00:16PM -0300, Paulo Zanoni wrote: > Hi > > 2013/3/25 Damien Lespiau <damien.lespiau@intel.com>: > > If TRANS_DDI_FUNC_CTL has been wrongly programmed with an incorrect > > port, we are currently trying to read PORT_CLK_SEL(port) with an > > uninitialized value. > > > > Handle that case by returning PORT_CLK_SEL_NONE and warning about it. > > > > v2: Move the warning inside intel_ddi_get_crtc_pll (Paulo Zanoni) > > > > Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> > > Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Queued for -next, thanks for the patch. -Daniel
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index d26147c..258e38e 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -1160,7 +1160,7 @@ static uint32_t intel_ddi_get_crtc_pll(struct drm_i915_private *dev_priv, enum pipe pipe) { uint32_t temp, ret; - enum port port; + enum port port = I915_MAX_PORTS; enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, pipe); int i; @@ -1176,10 +1176,16 @@ static uint32_t intel_ddi_get_crtc_pll(struct drm_i915_private *dev_priv, port = i; } - ret = I915_READ(PORT_CLK_SEL(port)); - - DRM_DEBUG_KMS("Pipe %c connected to port %c using clock 0x%08x\n", - pipe_name(pipe), port_name(port), ret); + if (port == I915_MAX_PORTS) { + WARN(1, "Pipe %c enabled on an unknown port\n", + pipe_name(pipe)); + ret = PORT_CLK_SEL_NONE; + } else { + ret = I915_READ(PORT_CLK_SEL(port)); + DRM_DEBUG_KMS("Pipe %c connected to port %c using clock " + "0x%08x\n", pipe_name(pipe), port_name(port), + ret); + } return ret; }
If TRANS_DDI_FUNC_CTL has been wrongly programmed with an incorrect port, we are currently trying to read PORT_CLK_SEL(port) with an uninitialized value. Handle that case by returning PORT_CLK_SEL_NONE and warning about it. v2: Move the warning inside intel_ddi_get_crtc_pll (Paulo Zanoni) Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> --- drivers/gpu/drm/i915/intel_ddi.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)