Commit 9160095c authored by Jani Nikula's avatar Jani Nikula

drm/i915: use BUILD_BUG_ON to ensure platform name has been set up

Leave the runtime check in place in case the platform variable itself
comes from bogus sources.
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488280303-9323-1-git-send-email-jani.nikula@intel.com
parent 0129936d
...@@ -889,6 +889,7 @@ enum intel_platform { ...@@ -889,6 +889,7 @@ enum intel_platform {
INTEL_BROXTON, INTEL_BROXTON,
INTEL_KABYLAKE, INTEL_KABYLAKE,
INTEL_GEMINILAKE, INTEL_GEMINILAKE,
INTEL_MAX_PLATFORMS
}; };
struct intel_device_info { struct intel_device_info {
......
...@@ -56,6 +56,8 @@ static const char * const platform_names[] = { ...@@ -56,6 +56,8 @@ static const char * const platform_names[] = {
const char *intel_platform_name(enum intel_platform platform) 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) || if (WARN_ON_ONCE(platform >= ARRAY_SIZE(platform_names) ||
platform_names[platform] == NULL)) platform_names[platform] == NULL))
return "<unknown>"; return "<unknown>";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment