diff options
author | Jike Song <jike.song@intel.com> | 2017-01-06 15:16:22 +0800 |
---|---|---|
committer | Zhenyu Wang <zhenyuw@linux.intel.com> | 2017-01-09 11:11:21 +0800 |
commit | 4e5378918b5b96e6b93fcadf1ab84a8486ca60a1 (patch) | |
tree | f793fe43b0ddeec4ae80e45cc52ba07d61269f81 /drivers/gpu/drm/i915 | |
parent | 59c0573dfbd5f66e3aa54c2ce0bebcb0953d4db4 (diff) | |
download | lwn-4e5378918b5b96e6b93fcadf1ab84a8486ca60a1.tar.gz lwn-4e5378918b5b96e6b93fcadf1ab84a8486ca60a1.zip |
drm/i915/gvt: destroy the allocated idr on vgpu creating failures
Once idr_alloc gets called data is allocated within the idr list, if
any error occurs afterwards, we should undo that by idr_remove on the
error path.
Signed-off-by: Jike Song <jike.song@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r-- | drivers/gpu/drm/i915/gvt/vgpu.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c index 398abb98dd0a..f0e86123e45b 100644 --- a/drivers/gpu/drm/i915/gvt/vgpu.c +++ b/drivers/gpu/drm/i915/gvt/vgpu.c @@ -304,7 +304,7 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt, ret = setup_vgpu_mmio(vgpu); if (ret) - goto out_free_vgpu; + goto out_clean_idr; ret = intel_vgpu_alloc_resource(vgpu, param); if (ret) @@ -355,6 +355,8 @@ out_clean_vgpu_resource: intel_vgpu_free_resource(vgpu); out_clean_vgpu_mmio: clean_vgpu_mmio(vgpu); +out_clean_idr: + idr_remove(&gvt->vgpu_idr, vgpu->id); out_free_vgpu: vfree(vgpu); mutex_unlock(&gvt->lock); |