[Intel-gfx] [PATCH 03/12] drm/i915: Don't return inside WA_REG macro

Mika Kuoppala mika.kuoppala at linux.intel.com
Tue Oct 6 07:26:44 PDT 2015


It is considered a very bad practice to return inside
a macro. Instead of returning, emit a warning.

Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 71b4fac..bc8a8e2 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -783,8 +783,7 @@ static int wa_add(struct i915_workarounds *w,
 #define WA_REG(addr, mask, val) do { \
 		const int r = wa_add(&dev_priv->lri_workarounds, \
 				     (addr), (mask), (val)); \
-		if (r) \
-			return r; \
+		WARN_ON(r); \
 	} while (0)
 
 #define WA_SET_BIT_MASKED(addr, mask) \
-- 
2.1.4



More information about the Intel-gfx mailing list