From: Dave Gordon <david.s.gordon@intel.com>
To: Arun Siluvery <arun.siluvery@linux.intel.com>,
intel-gfx@lists.freedesktop.org
Cc: Ben Widawsky <benjamin.widawsky@intel.com>,
Mika Kuoppala <mika.kuoppala@intel.com>
Subject: Re: [PATCH v1 1/2] drm/i915: Contain the WA_REG macro
Date: Wed, 12 Aug 2015 16:40:03 +0100 [thread overview]
Message-ID: <55CB68D3.9060105@intel.com> (raw)
In-Reply-To: <1439304272-9645-2-git-send-email-arun.siluvery@linux.intel.com>
On 11/08/15 15:44, Arun Siluvery wrote:
> From: Mika Kuoppala <mika.kuoppala@intel.com>
>
> Prevent leaking the if scoping by containing the WA_REG
> macro inside its own scope.
>
> Reported-by: Arun Siluvery <arun.siluvery@linux.intel.com>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
> drivers/gpu/drm/i915/intel_ringbuffer.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 1c14233..cf61262 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -780,11 +780,11 @@ static int wa_add(struct drm_i915_private *dev_priv,
> return 0;
> }
>
> -#define WA_REG(addr, mask, val) { \
> +#define WA_REG(addr, mask, val) do { \
> const int r = wa_add(dev_priv, (addr), (mask), (val)); \
> if (r) \
> return r; \
> - }
> + } while(0)
>
> #define WA_SET_BIT_MASKED(addr, mask) \
> WA_REG(addr, (mask), _MASKED_BIT_ENABLE(mask))
On the one hand, yes, this definitely needs the do-while wrapper.
OTOH, hiding a conditional 'return' inside a macro is an abomination :(
At least it's only local to this file ...
So, on the grounds that this makes it more correct if no less ugly:
Reviewed-by: Dave Gordon <david.s.gordon@intel.com>
.Dave.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-08-12 15:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-11 14:44 [PATCH v1 0/2] Enable legacy behaviour for Push constants Arun Siluvery
2015-08-11 14:44 ` [PATCH v1 1/2] drm/i915: Contain the WA_REG macro Arun Siluvery
2015-08-12 15:40 ` Dave Gordon [this message]
2015-08-14 8:51 ` Daniel Vetter
2015-08-11 14:44 ` [PATCH v1 2/2] drm/i915/gen9: Disable gather at set shader bit Arun Siluvery
2015-08-12 15:41 ` Dave Gordon
2015-08-12 15:55 ` Siluvery, Arun
2015-08-14 8:54 ` Daniel Vetter
2015-08-14 21:17 ` shuang.he
2015-08-11 20:58 ` [PATCH v1 0/2] Enable legacy behaviour for Push constants Timo Aaltonen
2015-08-12 12:22 ` Siluvery, Arun
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=55CB68D3.9060105@intel.com \
--to=david.s.gordon@intel.com \
--cc=arun.siluvery@linux.intel.com \
--cc=benjamin.widawsky@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mika.kuoppala@intel.com \
/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