diff mbox

drm/i915/uc: Drop use of MISSING_CASE on trivial enums

Message ID 20170331102652.177664-1-michal.wajdeczko@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michal Wajdeczko March 31, 2017, 10:26 a.m. UTC
We can rely on compiler to notify us if we miss any case.
This approach may also reduce driver size (reported ~4K).

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_uc.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Chris Wilson March 31, 2017, 1:42 p.m. UTC | #1
On Fri, Mar 31, 2017 at 10:26:52AM +0000, Michal Wajdeczko wrote:
> We can rely on compiler to notify us if we miss any case.
> This approach may also reduce driver size (reported ~4K).
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

With the default compile flags,

drivers/gpu/drm/i915/intel_uc.h: In function ‘intel_uc_fw_type_repr’:
drivers/gpu/drm/i915/intel_uc.h:130:2: warning: enumeration value ‘THIS_DOES_NOT_EXIST’ not handled in switch [-Wswitch]
  switch (type) {

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Chris Wilson March 31, 2017, 8:12 p.m. UTC | #2
On Fri, Mar 31, 2017 at 12:41:41PM -0000, Patchwork wrote:
> == Series Details ==
> 
> Series: drm/i915/uc: Drop use of MISSING_CASE on trivial enums
> URL   : https://patchwork.freedesktop.org/series/22274/
> State : success
> 
> == Summary ==
> 
> Series 22274v1 drm/i915/uc: Drop use of MISSING_CASE on trivial enums
> https://patchwork.freedesktop.org/api/1.0/series/22274/revisions/1/mbox/

And pushed. Thanks,
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index d2dcde7..4b7f73a 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -114,10 +114,8 @@  const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status)
 		return "PENDING";
 	case INTEL_UC_FIRMWARE_SUCCESS:
 		return "SUCCESS";
-	default:
-		MISSING_CASE(status);
-		return "<invalid>";
 	}
+	return "<invalid>";
 }
 
 enum intel_uc_fw_type {
@@ -133,10 +131,8 @@  static inline const char *intel_uc_fw_type_repr(enum intel_uc_fw_type type)
 		return "GuC";
 	case INTEL_UC_FW_TYPE_HUC:
 		return "HuC";
-	default:
-		MISSING_CASE(type);
-		return "<invalid>";
 	}
+	return "uC";
 }
 
 /*