提交 59c0573d 编写于 作者: J Jike Song 提交者: Zhenyu Wang

drm/i915/gvt: init/destroy vgpu_idr properly

An idr should be initialized before use and destroyed afterwards.
Signed-off-by: NJike Song <jike.song@intel.com>
Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
上级 440a9b9f
...@@ -201,6 +201,8 @@ void intel_gvt_clean_device(struct drm_i915_private *dev_priv) ...@@ -201,6 +201,8 @@ void intel_gvt_clean_device(struct drm_i915_private *dev_priv)
intel_gvt_hypervisor_host_exit(&dev_priv->drm.pdev->dev, gvt); intel_gvt_hypervisor_host_exit(&dev_priv->drm.pdev->dev, gvt);
intel_gvt_clean_vgpu_types(gvt); intel_gvt_clean_vgpu_types(gvt);
idr_destroy(&gvt->vgpu_idr);
kfree(dev_priv->gvt); kfree(dev_priv->gvt);
dev_priv->gvt = NULL; dev_priv->gvt = NULL;
} }
...@@ -237,6 +239,8 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv) ...@@ -237,6 +239,8 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv)
gvt_dbg_core("init gvt device\n"); gvt_dbg_core("init gvt device\n");
idr_init(&gvt->vgpu_idr);
mutex_init(&gvt->lock); mutex_init(&gvt->lock);
gvt->dev_priv = dev_priv; gvt->dev_priv = dev_priv;
...@@ -244,7 +248,7 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv) ...@@ -244,7 +248,7 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv)
ret = intel_gvt_setup_mmio_info(gvt); ret = intel_gvt_setup_mmio_info(gvt);
if (ret) if (ret)
return ret; goto out_clean_idr;
ret = intel_gvt_load_firmware(gvt); ret = intel_gvt_load_firmware(gvt);
if (ret) if (ret)
...@@ -313,6 +317,8 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv) ...@@ -313,6 +317,8 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv)
intel_gvt_free_firmware(gvt); intel_gvt_free_firmware(gvt);
out_clean_mmio_info: out_clean_mmio_info:
intel_gvt_clean_mmio_info(gvt); intel_gvt_clean_mmio_info(gvt);
out_clean_idr:
idr_destroy(&gvt->vgpu_idr);
kfree(gvt); kfree(gvt);
return ret; return ret;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册