drm/i915: Guard debugfs against invalid access without display
authorLucas De Marchi <lucas.demarchi@intel.com>
Tue, 27 Oct 2020 04:46:16 +0000 (21:46 -0700)
committerLucas De Marchi <lucas.demarchi@intel.com>
Wed, 28 Oct 2020 07:32:54 +0000 (00:32 -0700)
Do not create the display debugfs files when we don't have display.

Based on previous patch by José Souza.

Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201027044618.719064-1-lucas.demarchi@intel.com
drivers/gpu/drm/i915/i915_drv.c

index ad0dcaacc1a2eb9e948a435e3742223b01c02d16..e1e056ffff29dff711115ff74736c31a3eb27dcf 100644 (file)
@@ -671,7 +671,8 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
        /* Reveal our presence to userspace */
        if (drm_dev_register(dev, 0) == 0) {
                i915_debugfs_register(dev_priv);
-               intel_display_debugfs_register(dev_priv);
+               if (HAS_DISPLAY(dev_priv))
+                       intel_display_debugfs_register(dev_priv);
                i915_setup_sysfs(dev_priv);
 
                /* Depends on sysfs having been initialized */