[Intel-gfx] [PATCH] drm/i915: Reword warning for missing cases
Lucas De Marchi
lucas.demarchi at intel.com
Tue Mar 13 00:03:12 UTC 2018
In some places we end up converting switch statements to a series of
if/else, particularly when introducing helper functions to handle a
group of cases. It's tempting to either leave a wrong warning (since now
we don't have a switch case anymore) or to convert to WARN(1, ...),
losing what MISSING_CASE() provides: source location and id number.
Fix the message to allow reusing MISSING_CASE() - it may not always be
correct (e.g. if you are not checking an id anymore), but it avoids
useless conversions. A quick grep reveals at least a few users in
drivers/gpu/drm/i915/intel_csr.c and drivers/gpu/drm/i915/intel_ddi.c.
Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
drivers/gpu/drm/i915/i915_utils.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 51dbfe5bb418..8cdc21b92f5f 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -40,7 +40,7 @@
#undef WARN_ON_ONCE
#define WARN_ON_ONCE(x) WARN_ONCE((x), "%s", "WARN_ON_ONCE(" __stringify(x) ")")
-#define MISSING_CASE(x) WARN(1, "Missing switch case (%lu) in %s\n", \
+#define MISSING_CASE(x) WARN(1, "Missing case (%lu) in %s\n", \
(long)(x), __func__)
#if GCC_VERSION >= 70000
--
2.14.3
More information about the Intel-gfx
mailing list