[Intel-gfx] [PATCH] drm/i915: make GEM_WARN_ON less terrible

Matthew Auld matthew.auld at intel.com
Mon Mar 19 18:08:54 UTC 2018


GEM_WARN_ON() was originally intended to be used only as:

   if (GEM_WARN_ON(expr))
	...

but it just so happens to also work as simply:

   GEM_WARN_ON(expr);

since it just wraps WARN_ON, which is a little misleading since for
!DRM_I915_DEBUG_GEM builds the second case will actually break the
build. Given that there are some patches floating around which seem to
miss this, it probably makes sense to just make it work for both cases.

Signed-off-by: Matthew Auld <matthew.auld at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 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 8922344fc21b..6a4375437b88 100644
--- a/drivers/gpu/drm/i915/i915_gem.h
+++ b/drivers/gpu/drm/i915/i915_gem.h
@@ -44,7 +44,7 @@
 
 #else
 #define GEM_BUG_ON(expr) BUILD_BUG_ON_INVALID(expr)
-#define GEM_WARN_ON(expr) (BUILD_BUG_ON_INVALID(expr), 0)
+#define GEM_WARN_ON(expr) ({BUILD_BUG_ON_INVALID(expr), 0;})
 
 #define GEM_DEBUG_DECL(var)
 #define GEM_DEBUG_EXEC(expr) do { } while (0)
-- 
2.14.3



More information about the Intel-gfx mailing list