Commit 9f172f6f authored by Chris Wilson's avatar Chris Wilson

drm/i915: Call i915_perf_fini() on init_hw error unwind

We have to cleanup after i915_perf_init(), even on the error path, as it
passes a pointer into the module to the sysfs core. If we fail to
unregister the sysctl table, we leave a dangling pointer which then may
explode anytime later.

Fixes: 9f9b2792 ("drm/i915/perf: reuse timestamp frequency from device info")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: default avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180414091233.32224-1-chris@chris-wilson.co.uk
parent f4ecfbfc
...@@ -1101,30 +1101,32 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv) ...@@ -1101,30 +1101,32 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv)
ret = i915_ggtt_probe_hw(dev_priv); ret = i915_ggtt_probe_hw(dev_priv);
if (ret) if (ret)
return ret; goto err_perf;
/* WARNING: Apparently we must kick fbdev drivers before vgacon, /*
* otherwise the vga fbdev driver falls over. */ * WARNING: Apparently we must kick fbdev drivers before vgacon,
* otherwise the vga fbdev driver falls over.
*/
ret = i915_kick_out_firmware_fb(dev_priv); ret = i915_kick_out_firmware_fb(dev_priv);
if (ret) { if (ret) {
DRM_ERROR("failed to remove conflicting framebuffer drivers\n"); DRM_ERROR("failed to remove conflicting framebuffer drivers\n");
goto out_ggtt; goto err_ggtt;
} }
ret = i915_kick_out_vgacon(dev_priv); ret = i915_kick_out_vgacon(dev_priv);
if (ret) { if (ret) {
DRM_ERROR("failed to remove conflicting VGA console\n"); DRM_ERROR("failed to remove conflicting VGA console\n");
goto out_ggtt; goto err_ggtt;
} }
ret = i915_ggtt_init_hw(dev_priv); ret = i915_ggtt_init_hw(dev_priv);
if (ret) if (ret)
return ret; goto err_ggtt;
ret = i915_ggtt_enable_hw(dev_priv); ret = i915_ggtt_enable_hw(dev_priv);
if (ret) { if (ret) {
DRM_ERROR("failed to enable GGTT\n"); DRM_ERROR("failed to enable GGTT\n");
goto out_ggtt; goto err_ggtt;
} }
pci_set_master(pdev); pci_set_master(pdev);
...@@ -1135,7 +1137,7 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv) ...@@ -1135,7 +1137,7 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv)
if (ret) { if (ret) {
DRM_ERROR("failed to set DMA mask\n"); DRM_ERROR("failed to set DMA mask\n");
goto out_ggtt; goto err_ggtt;
} }
} }
...@@ -1153,7 +1155,7 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv) ...@@ -1153,7 +1155,7 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv)
if (ret) { if (ret) {
DRM_ERROR("failed to set DMA mask\n"); DRM_ERROR("failed to set DMA mask\n");
goto out_ggtt; goto err_ggtt;
} }
} }
...@@ -1186,13 +1188,14 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv) ...@@ -1186,13 +1188,14 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv)
ret = intel_gvt_init(dev_priv); ret = intel_gvt_init(dev_priv);
if (ret) if (ret)
goto out_ggtt; goto err_ggtt;
return 0; return 0;
out_ggtt: err_ggtt:
i915_ggtt_cleanup_hw(dev_priv); i915_ggtt_cleanup_hw(dev_priv);
err_perf:
i915_perf_fini(dev_priv);
return ret; return ret;
} }
......
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