Message ID | 1402938115-24943-1-git-send-email-matthew.d.roper@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Jun 16, 2014 at 10:01:55AM -0700, Matt Roper wrote: > Now that the primary plane can be disabled independently of the CRTC, > the debugfs code needs to be updated to recognize when the primary plane > is disabled and not try to return information about the primary plane's > framebuffer. > > This change prevents a NULL dereference when reading i915_display_info > with a disabled primary plane. > > Signed-off-by: Matt Roper <matthew.d.roper@intel.com> > --- > drivers/gpu/drm/i915/i915_debugfs.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c > index a8b8140..28aa591 100644 > --- a/drivers/gpu/drm/i915/i915_debugfs.c > +++ b/drivers/gpu/drm/i915/i915_debugfs.c > @@ -2220,9 +2220,12 @@ static void intel_crtc_info(struct seq_file *m, struct intel_crtc *intel_crtc) > struct drm_crtc *crtc = &intel_crtc->base; > struct intel_encoder *intel_encoder; > > - seq_printf(m, "\tfb: %d, pos: %dx%d, size: %dx%d\n", > - crtc->primary->fb->base.id, crtc->x, crtc->y, > - crtc->primary->fb->width, crtc->primary->fb->height); > + if (crtc->primary->fb) > + seq_printf(m, "\tfb: %d, pos: %dx%d, size: %dx%d\n", > + crtc->primary->fb->base.id, crtc->x, crtc->y, > + crtc->primary->fb->width, crtc->primary->fb->height); > + else > + seq_printf(m, "\tprimary plane disabled\n"); seq_puts() > for_each_encoder_on_crtc(dev, crtc, intel_encoder) > intel_encoder_info(m, intel_crtc, intel_encoder); > }
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index a8b8140..28aa591 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -2220,9 +2220,12 @@ static void intel_crtc_info(struct seq_file *m, struct intel_crtc *intel_crtc) struct drm_crtc *crtc = &intel_crtc->base; struct intel_encoder *intel_encoder; - seq_printf(m, "\tfb: %d, pos: %dx%d, size: %dx%d\n", - crtc->primary->fb->base.id, crtc->x, crtc->y, - crtc->primary->fb->width, crtc->primary->fb->height); + if (crtc->primary->fb) + seq_printf(m, "\tfb: %d, pos: %dx%d, size: %dx%d\n", + crtc->primary->fb->base.id, crtc->x, crtc->y, + crtc->primary->fb->width, crtc->primary->fb->height); + else + seq_printf(m, "\tprimary plane disabled\n"); for_each_encoder_on_crtc(dev, crtc, intel_encoder) intel_encoder_info(m, intel_crtc, intel_encoder); }
Now that the primary plane can be disabled independently of the CRTC, the debugfs code needs to be updated to recognize when the primary plane is disabled and not try to return information about the primary plane's framebuffer. This change prevents a NULL dereference when reading i915_display_info with a disabled primary plane. Signed-off-by: Matt Roper <matthew.d.roper@intel.com> --- drivers/gpu/drm/i915/i915_debugfs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)