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
This commit is contained in:
Jani Nikula 2017-02-28 13:11:43 +02:00
Родитель 0129936ddd
Коммит 9160095c0e
2 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

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

Просмотреть файл

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