drm/i915: use BUILD_BUG_ON to ensure platform name has been set up
authorJani Nikula <jani.nikula@intel.com>
Tue, 28 Feb 2017 11:11:43 +0000 (13:11 +0200)
committerJani Nikula <jani.nikula@intel.com>
Wed, 1 Mar 2017 11:11:24 +0000 (13:11 +0200)
Leave the runtime check in place in case the platform variable itself
comes from bogus sources.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488280303-9323-1-git-send-email-jani.nikula@intel.com
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_device_info.c

index 71152656ebbfe46646f087a4e611703755c3af59..48b34a9377920770dc0d6b33fb931900abd436bf 100644 (file)
@@ -889,6 +889,7 @@ enum intel_platform {
        INTEL_BROXTON,
        INTEL_KABYLAKE,
        INTEL_GEMINILAKE,
+       INTEL_MAX_PLATFORMS
 };
 
 struct intel_device_info {
index 2e1fd857e625dfe89d86ab8276ca08aac8606194..9fc6ab783008916ff0c61c6614f8a30cbff25427 100644 (file)
@@ -56,6 +56,8 @@ static const char * const platform_names[] = {
 
 const char *intel_platform_name(enum intel_platform platform)
 {
+       BUILD_BUG_ON(ARRAY_SIZE(platform_names) != INTEL_MAX_PLATFORMS);
+
        if (WARN_ON_ONCE(platform >= ARRAY_SIZE(platform_names) ||
                         platform_names[platform] == NULL))
                return "<unknown>";