Patchwork [3/3] drm/radeon/kms: Fix retrying ttm_bo_init() after it failed once.

login
register
mail settings
Submitter Andy Whitcroft
Date March 2, 2011, 5:55 p.m.
Message ID <1299088507-1094-4-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/85120/
State Accepted
Delegated to: Tim Gardner
Headers show

Comments

Andy Whitcroft - March 2, 2011, 5:55 p.m.
From: Michel Dänzer <daenzer@vmware.com>

If ttm_bo_init() returns failure, it already destroyed the BO, so we need to
retry from scratch.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>

(cherry picked from commit 2b66b50b12cabc05f05543e792d4c9c2465d5702)
BugLink: http://bugs.launchpad.net/bugs/652934
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 drivers/gpu/drm/radeon/radeon_object.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index f23a199..d856a59 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -101,6 +101,8 @@  int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj,
 		type = ttm_bo_type_device;
 	}
 	*bo_ptr = NULL;
+
+retry:
 	bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL);
 	if (bo == NULL)
 		return -ENOMEM;
@@ -108,8 +110,6 @@  int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj,
 	bo->gobj = gobj;
 	bo->surface_reg = -1;
 	INIT_LIST_HEAD(&bo->list);
-
-retry:
 	radeon_ttm_placement_from_domain(bo, domain);
 	/* Kernel allocation are uninterruptible */
 	r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type,