public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: Squelch smatch warning for	statement with no effect
Date: Wed, 25 Jan 2017 13:25:24 +0200	[thread overview]
Message-ID: <87vat34c0r.fsf@intel.com> (raw)
In-Reply-To: <20170120214530.1062-1-chris@chris-wilson.co.uk>

On Fri, 20 Jan 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> The sgt iterators cause an
>
> drivers/gpu/drm/i915/i915_gpu_error.c:846 i915_error_object_create() warn: statement has no effect 7
>
> everywhere they are used. If we change the code slightly, we can achieve
> the same increment without altering the output or raising a warning.

I've never liked using logical OR short circuiting for assignments like
this anyway, so I think this is an improvement no matter what.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


>
>    text	   data	    bss	    dec	    hex	filename
> 1267906	  20587	   3168	1291661	 13b58d	before
> 1267906	  20587	   3168	1291661	 13b58d	after
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_drv.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 1b340eb0db19..ebe2f6c737f7 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2620,8 +2620,8 @@ static inline struct scatterlist *__sg_next(struct scatterlist *sg)
>  #define for_each_sgt_dma(__dmap, __iter, __sgt)				\
>  	for ((__iter) = __sgt_iter((__sgt)->sgl, true);			\
>  	     ((__dmap) = (__iter).dma + (__iter).curr);			\
> -	     (((__iter).curr += PAGE_SIZE) < (__iter).max) ||		\
> -	     ((__iter) = __sgt_iter(__sg_next((__iter).sgp), true), 0))
> +	     (((__iter).curr += PAGE_SIZE) >= (__iter).max) ?		\
> +	     (__iter) = __sgt_iter(__sg_next((__iter).sgp), true), 0 : 0)
>  
>  /**
>   * for_each_sgt_page - iterate over the pages of the given sg_table
> @@ -2633,8 +2633,8 @@ static inline struct scatterlist *__sg_next(struct scatterlist *sg)
>  	for ((__iter) = __sgt_iter((__sgt)->sgl, false);		\
>  	     ((__pp) = (__iter).pfn == 0 ? NULL :			\
>  	      pfn_to_page((__iter).pfn + ((__iter).curr >> PAGE_SHIFT))); \
> -	     (((__iter).curr += PAGE_SIZE) < (__iter).max) ||		\
> -	     ((__iter) = __sgt_iter(__sg_next((__iter).sgp), false), 0))
> +	     (((__iter).curr += PAGE_SIZE) >= (__iter).max) ?		\
> +	     (__iter) = __sgt_iter(__sg_next((__iter).sgp), false), 0 : 0)
>  
>  static inline const struct intel_device_info *
>  intel_info(const struct drm_i915_private *dev_priv)

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2017-01-25 11:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-20 21:45 [PATCH 1/2] drm/i915: Squelch smatch warning for statement with no effect Chris Wilson
2017-01-20 21:45 ` [PATCH 2/2] drm/i915: Silence smatch for cmdparser Chris Wilson
2017-01-25  9:04   ` Chris Wilson
2017-01-25 11:16   ` Jani Nikula
2017-01-20 22:24 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Squelch smatch warning for statement with no effect Patchwork
2017-01-25 11:25 ` Jani Nikula [this message]

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=87vat34c0r.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --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