linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: avoid harmless empty-body warning
@ 2016-11-08 13:58 Arnd Bergmann
  2016-11-08 14:49 ` Chris Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2016-11-08 13:58 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Arnd Bergmann, Jani Nikula, David Airlie, Joonas Lahtinen,
	Chris Wilson, intel-gfx, dri-devel, linux-kernel

The newly added assert_kernel_context_is_current introduces a warning
when built with W=1:

drivers/gpu/drm/i915/i915_gem.c: In function ‘assert_kernel_context_is_current’:
drivers/gpu/drm/i915/i915_gem.c:4417:63: error: suggest braces around empty body in an ‘else’ statement [-Werror=empty-body]

Changing the GEM_BUG_ON() macro from an empty definition to "do { } while (0)"
makes the macro more robust to use and avoids the warning.

Fixes: 3033acab07f9 ("drm/i915: Queue the idling context switch after all other timelines")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/i915/i915_gem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.h b/drivers/gpu/drm/i915/i915_gem.h
index 735580d72eb1..51ec793f2e20 100644
--- a/drivers/gpu/drm/i915/i915_gem.h
+++ b/drivers/gpu/drm/i915/i915_gem.h
@@ -28,7 +28,7 @@
 #ifdef CONFIG_DRM_I915_DEBUG_GEM
 #define GEM_BUG_ON(expr) BUG_ON(expr)
 #else
-#define GEM_BUG_ON(expr)
+#define GEM_BUG_ON(expr) do { } while (0)
 #endif
 
 #define I915_NUM_ENGINES 5
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/i915: avoid harmless empty-body warning
  2016-11-08 13:58 [PATCH] drm/i915: avoid harmless empty-body warning Arnd Bergmann
@ 2016-11-08 14:49 ` Chris Wilson
  2016-11-08 16:35   ` [Intel-gfx] " Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2016-11-08 14:49 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Daniel Vetter, Jani Nikula, David Airlie, Joonas Lahtinen,
	intel-gfx, dri-devel, linux-kernel

On Tue, Nov 08, 2016 at 02:58:17PM +0100, Arnd Bergmann wrote:
> The newly added assert_kernel_context_is_current introduces a warning
> when built with W=1:
> 
> drivers/gpu/drm/i915/i915_gem.c: In function ‘assert_kernel_context_is_current’:
> drivers/gpu/drm/i915/i915_gem.c:4417:63: error: suggest braces around empty body in an ‘else’ statement [-Werror=empty-body]
> 
> Changing the GEM_BUG_ON() macro from an empty definition to "do { } while (0)"
> makes the macro more robust to use and avoids the warning.
> 
> Fixes: 3033acab07f9 ("drm/i915: Queue the idling context switch after all other timelines")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915: avoid harmless empty-body warning
  2016-11-08 14:49 ` Chris Wilson
@ 2016-11-08 16:35   ` Daniel Vetter
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2016-11-08 16:35 UTC (permalink / raw)
  To: Chris Wilson, Arnd Bergmann, Daniel Vetter, Jani Nikula,
	David Airlie, Joonas Lahtinen, intel-gfx, dri-devel,
	linux-kernel

On Tue, Nov 08, 2016 at 02:49:05PM +0000, Chris Wilson wrote:
> On Tue, Nov 08, 2016 at 02:58:17PM +0100, Arnd Bergmann wrote:
> > The newly added assert_kernel_context_is_current introduces a warning
> > when built with W=1:
> > 
> > drivers/gpu/drm/i915/i915_gem.c: In function ‘assert_kernel_context_is_current’:
> > drivers/gpu/drm/i915/i915_gem.c:4417:63: error: suggest braces around empty body in an ‘else’ statement [-Werror=empty-body]
> > 
> > Changing the GEM_BUG_ON() macro from an empty definition to "do { } while (0)"
> > makes the macro more robust to use and avoids the warning.
> > 
> > Fixes: 3033acab07f9 ("drm/i915: Queue the idling context switch after all other timelines")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Queued for -next, thanks for the patch.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-08 16:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-08 13:58 [PATCH] drm/i915: avoid harmless empty-body warning Arnd Bergmann
2016-11-08 14:49 ` Chris Wilson
2016-11-08 16:35   ` [Intel-gfx] " Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).