From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Widawsky Subject: Re: [PATCH 3/6] drm/i915: Error out if we are trying to use VGA with SPLL already in use Date: Fri, 8 Mar 2013 13:06:56 -0800 Message-ID: <20130308210656.GD31789@bwidawsk.net> References: <1362670228-19494-1-git-send-email-damien.lespiau@intel.com> <1362670228-19494-3-git-send-email-damien.lespiau@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from shiva.localdomain (209-20-75-48.static.cloud-ips.com [209.20.75.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 7E55EE5C11 for ; Fri, 8 Mar 2013 13:06:59 -0800 (PST) Content-Disposition: inline In-Reply-To: <1362670228-19494-3-git-send-email-damien.lespiau@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Damien Lespiau Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Thu, Mar 07, 2013 at 03:30:25PM +0000, Damien Lespiau wrote: > Our static analysis tool noticed that 'reg' could be used uninitialized if > we are trying to get a PLL to drive VGA and SPLL is already in use > (plls->spll_refcoung != 0). > > In the (error) case above, let's return false to the caller and emit an > error. > > Signed-off-by: Damien Lespiau > --- > drivers/gpu/drm/i915/intel_ddi.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c > index a1505e3..0eab200 100644 > --- a/drivers/gpu/drm/i915/intel_ddi.c > +++ b/drivers/gpu/drm/i915/intel_ddi.c > @@ -898,6 +898,9 @@ bool intel_ddi_pll_mode_set(struct drm_crtc *crtc, int clock) > plls->spll_refcount++; > reg = SPLL_CTL; > intel_crtc->ddi_pll_sel = PORT_CLK_SEL_SPLL; > + } else { > + DRM_ERROR("SPLL already in use\n"); > + return false; > } > > WARN(I915_READ(reg) & SPLL_PLL_ENABLE, I know very little about this code, but the warning still seems valuable to me. How about instead of else, move the reg = SPLL_CTL above the 'if' -- Ben Widawsky, Intel Open Source Technology Center