1
0
Fork 0

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: 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
hifive-unleashed-5.1
Jani Nikula 2017-02-28 13:11:43 +02:00
parent 0129936ddd
commit 9160095c0e
2 changed files with 3 additions and 0 deletions

View File

@ -889,6 +889,7 @@ enum intel_platform {
INTEL_BROXTON,
INTEL_KABYLAKE,
INTEL_GEMINILAKE,
INTEL_MAX_PLATFORMS
};
struct intel_device_info {

View 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>";