forked from luck/tmp_suning_uos_patched
drm/i915: Unpin the fb on error during construction.
If we fail whilst constructing the fb, then we need to unpin it as well. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Dave Airlie <airlied@linux.ie>
This commit is contained in:
parent
3eb2ee77b0
commit
b4476f52e4
@ -473,7 +473,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
|
|||||||
ret = intel_framebuffer_create(dev, &mode_cmd, &fb, fbo);
|
ret = intel_framebuffer_create(dev, &mode_cmd, &fb, fbo);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
DRM_ERROR("failed to allocate fb.\n");
|
DRM_ERROR("failed to allocate fb.\n");
|
||||||
goto out_unref;
|
goto out_unpin;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_add(&fb->filp_head, &dev->mode_config.fb_kernel_list);
|
list_add(&fb->filp_head, &dev->mode_config.fb_kernel_list);
|
||||||
@ -484,7 +484,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
|
|||||||
info = framebuffer_alloc(sizeof(struct intelfb_par), device);
|
info = framebuffer_alloc(sizeof(struct intelfb_par), device);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto out_unref;
|
goto out_unpin;
|
||||||
}
|
}
|
||||||
|
|
||||||
par = info->par;
|
par = info->par;
|
||||||
@ -513,7 +513,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
|
|||||||
size);
|
size);
|
||||||
if (!info->screen_base) {
|
if (!info->screen_base) {
|
||||||
ret = -ENOSPC;
|
ret = -ENOSPC;
|
||||||
goto out_unref;
|
goto out_unpin;
|
||||||
}
|
}
|
||||||
info->screen_size = size;
|
info->screen_size = size;
|
||||||
|
|
||||||
@ -608,6 +608,8 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
|
|||||||
mutex_unlock(&dev->struct_mutex);
|
mutex_unlock(&dev->struct_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
out_unpin:
|
||||||
|
i915_gem_object_unpin(fbo);
|
||||||
out_unref:
|
out_unref:
|
||||||
drm_gem_object_unreference(fbo);
|
drm_gem_object_unreference(fbo);
|
||||||
mutex_unlock(&dev->struct_mutex);
|
mutex_unlock(&dev->struct_mutex);
|
||||||
|
Loading…
Reference in New Issue
Block a user