From: Mika Kuoppala Date: Thu, 16 Nov 2017 08:39:54 +0000 (+0200) Subject: drm/i915: Print the condition causing GEM_BUG_ON X-Git-Tag: v4.16-rc1~96^2~31^2~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d5653ec322ff132c2d6976ca0b909e0a9d1da6af;p=thirdparty%2Fkernel%2Fstable.git drm/i915: Print the condition causing GEM_BUG_ON It is easier to categorize and debug bugs if the failed condition is in plain sight in the actual dmesg output. Make it so. Cc: Chris Wilson Cc: Joonas Lahtinen Cc: Marta Lofstedt Signed-off-by: Mika Kuoppala Reviewed-by: Joonas Lahtinen Reviewed-by: Marta Lofstedt Link: https://patchwork.freedesktop.org/patch/msgid/20171116083954.3357-1-mika.kuoppala@linux.intel.com --- diff --git a/drivers/gpu/drm/i915/i915_gem.h b/drivers/gpu/drm/i915/i915_gem.h index ff42b5f0e9812..e920dab7f1b8c 100644 --- a/drivers/gpu/drm/i915/i915_gem.h +++ b/drivers/gpu/drm/i915/i915_gem.h @@ -28,7 +28,11 @@ #include #ifdef CONFIG_DRM_I915_DEBUG_GEM -#define GEM_BUG_ON(expr) BUG_ON(expr) +#define GEM_BUG_ON(condition) do { if (unlikely((condition))) { \ + printk(KERN_ERR "GEM_BUG_ON(%s)\n", __stringify(condition)); \ + BUG(); \ + } \ + } while(0) #define GEM_WARN_ON(expr) WARN_ON(expr) #define GEM_DEBUG_DECL(var) var