public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Damien Lespiau <damien.lespiau@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Fix erroneous conversion to u8
Date: Fri, 8 Aug 2014 21:32:20 +0300	[thread overview]
Message-ID: <20140808183220.GI4193@intel.com> (raw)
In-Reply-To: <1407522357-18474-1-git-send-email-damien.lespiau@intel.com>

On Fri, Aug 08, 2014 at 07:25:57PM +0100, Damien Lespiau wrote:
> adj was defined as u8. The issue is last_adj can be negative and adj is
> initialized with:
> 
>   adj = dev_priv->rps.last_adj;
> 
> and we were also happily doing things like:
> 
>   if (adj < 0)
> 
> (thank static analysers!)
> 
> v2: Make new_delay an int in case we overflow the u8 in the intermediate
>     computations. new_delay will get clamped at the end anyway. (Ville)
> 
> Cc: Deepak S <deepak.s@linux.intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_irq.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 9fdf738..8e6729e 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -1327,10 +1327,10 @@ static u32 vlv_c0_residency(struct drm_i915_private *dev_priv,
>   * @dev_priv: DRM device private
>   *
>   */
> -static u32 vlv_calc_delay_from_C0_counters(struct drm_i915_private *dev_priv)
> +static int vlv_calc_delay_from_C0_counters(struct drm_i915_private *dev_priv)
>  {
>  	u32 residency_C0_up = 0, residency_C0_down = 0;
> -	u8 new_delay, adj;
> +	int new_delay, adj;
>  
>  	dev_priv->rps.ei_interrupt_count++;
>  
> -- 
> 1.8.3.1

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2014-08-08 18:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08 17:34 [PATCH] drm/i915: Fix erroneous conversion to u8 Damien Lespiau
2014-08-08 17:56 ` Ville Syrjälä
2014-08-08 18:25   ` Damien Lespiau
2014-08-08 18:32     ` Ville Syrjälä [this message]
2014-08-08 18:52       ` 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=20140808183220.GI4193@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=damien.lespiau@intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox