drm/i915/opregion: use BUILD_BUG_ON to verify mailbox struct sizes
authorJani Nikula <jani.nikula@intel.com>
Thu, 2 Jul 2015 14:43:21 +0000 (17:43 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 6 Jul 2015 09:37:03 +0000 (11:37 +0200)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_opregion.c

index 71e87abdcae7c1aea0077949f7f7a91cf309732b..c4756a2d77bb98e76f10b8408d1968be51ec71e9 100644 (file)
@@ -862,6 +862,11 @@ int intel_opregion_setup(struct drm_device *dev)
        char buf[sizeof(OPREGION_SIGNATURE)];
        int err = 0;
 
+       BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100);
+       BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100);
+       BUILD_BUG_ON(sizeof(struct opregion_swsci) != 0x100);
+       BUILD_BUG_ON(sizeof(struct opregion_asle) != 0x100);
+
        pci_read_config_dword(dev->pdev, PCI_ASLS, &asls);
        DRM_DEBUG_DRIVER("graphic opregion physical addr: 0x%x\n", asls);
        if (asls == 0) {