All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: Ben Widawsky <ben@bwidawsk.net>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/6] drm/i915: Error out if we are trying to use VGA with SPLL already in use
Date: Fri, 22 Mar 2013 18:14:25 -0300	[thread overview]
Message-ID: <CA+gsUGSY9RZ5pjvA9kBEQt_TmA6noDJESs0wn1NdNpVTe5QEfA@mail.gmail.com> (raw)
In-Reply-To: <20130308210656.GD31789@bwidawsk.net>

Hi

2013/3/8 Ben Widawsky <ben@bwidawsk.net>:
> 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).

This was also reported by a human a few weeks ago and went to my TODO
list. Thanks for clearing my TODO list :)

>>
>> In the (error) case above, let's return false to the caller and emit an
>> error.
>>
>> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
>> ---
>>  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.

The WARN will still be hit in case no one is using SPLL but it's
enabled. It's a different problem.

The code added by Damien is correct, but it should never happen with
the current code because only the analog encoder tries to use SPLL and
there's only 1 analog encoder. But we can always introduce bugs to
trigger these errors :)

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

>
> How about instead of else, move the reg = SPLL_CTL above the 'if'
>
> --
> Ben Widawsky, Intel Open Source Technology Center
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Paulo Zanoni

  reply	other threads:[~2013-03-22 21:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-07 15:30 [PATCH 1/6] drm/i915: Warn if a pipe is enabled with a bogus port Damien Lespiau
2013-03-07 15:30 ` [PATCH 2/6] drm/i915: Initialize wait in intel_ddi_prepare_link_retrain() Damien Lespiau
2013-03-08 21:03   ` Ben Widawsky
2013-03-07 15:30 ` [PATCH 3/6] drm/i915: Error out if we are trying to use VGA with SPLL already in use Damien Lespiau
2013-03-08 21:06   ` Ben Widawsky
2013-03-22 21:14     ` Paulo Zanoni [this message]
2013-03-23 12:27       ` Daniel Vetter
2013-03-07 15:30 ` [PATCH 4/6] drm/i915: Cleanup if the EDP transcoder has a bobug input value Damien Lespiau
2013-03-22 21:34   ` Paulo Zanoni
2013-03-23 12:30     ` Daniel Vetter
2013-03-07 15:30 ` [PATCH 5/6] drm/i915: Rename intel_ddi_enable_pipe_func() to transcoder_func() Damien Lespiau
2013-03-22 21:37   ` Paulo Zanoni
2013-03-07 15:30 ` [PATCH 6/6] drm/i915: Use BUG() in a case of a programming error Damien Lespiau
2013-03-22 21:43   ` Paulo Zanoni
2013-03-23 12:31     ` Daniel Vetter
2013-03-22 21:04 ` [PATCH 1/6] drm/i915: Warn if a pipe is enabled with a bogus port Paulo Zanoni
2013-03-25 15:16   ` [PATCH v2] " Damien Lespiau
2013-03-25 17:00     ` Paulo Zanoni
2013-03-25 18:21       ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+gsUGSY9RZ5pjvA9kBEQt_TmA6noDJESs0wn1NdNpVTe5QEfA@mail.gmail.com \
    --to=przanoni@gmail.com \
    --cc=ben@bwidawsk.net \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.