From: Daniel Vetter Subject: Re: [PATCH] drm/i915: Handle disabled primary plane in debugfs i915_display_info (v2) Date: Mon, 16 Jun 2014 20:16:20 +0200 Message-ID: <20140616181620.GK5821@phenom.ffwll.local> References: <20140616170928.GN32694@strange.amr.corp.intel.com> <1402938775-30864-1-git-send-email-matthew.d.roper@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by gabe.freedesktop.org (Postfix) with ESMTP id B3C966E5C3 for ; Mon, 16 Jun 2014 11:16:27 -0700 (PDT) Received: by mail-wi0-f171.google.com with SMTP id n15so4555850wiw.4 for ; Mon, 16 Jun 2014 11:16:27 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1402938775-30864-1-git-send-email-matthew.d.roper@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Matt Roper Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Mon, Jun 16, 2014 at 10:12: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. > > v2: Replace a seq_printf() with seq_puts() (suggested by Damien) > > Signed-off-by: Matt Roper Queued for -next, thanks for the patch. -Daniel > --- > 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..8057fd4 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_puts(m, "\tprimary plane disabled\n"); > for_each_encoder_on_crtc(dev, crtc, intel_encoder) > intel_encoder_info(m, intel_crtc, intel_encoder); > } > -- > 1.8.5.1 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch