diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2010-11-09 15:31:44 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-11-09 20:52:19 -0500 |
commit | 7dfbbdcffebc41441e64278961f57d2840a76259 (patch) | |
tree | 5a536fdc99de855160409a33f5049ebb503c66de /drivers/gpu/drm/ttm | |
parent | 2b66b50b12cabc05f05543e792d4c9c2465d5702 (diff) |
drm/ttm: Be consistent on ttm_bo_init() failures
Call destroy() on _all_ ttm_bo_init() failures, and make sure that
behavior is documented in the function description.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index ce464579c485..3ca77dc03915 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -1144,6 +1144,10 @@ int ttm_bo_init(struct ttm_bo_device *bdev, | |||
1144 | num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; | 1144 | num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; |
1145 | if (num_pages == 0) { | 1145 | if (num_pages == 0) { |
1146 | printk(KERN_ERR TTM_PFX "Illegal buffer object size.\n"); | 1146 | printk(KERN_ERR TTM_PFX "Illegal buffer object size.\n"); |
1147 | if (destroy) | ||
1148 | (*destroy)(bo); | ||
1149 | else | ||
1150 | kfree(bo); | ||
1147 | return -EINVAL; | 1151 | return -EINVAL; |
1148 | } | 1152 | } |
1149 | bo->destroy = destroy; | 1153 | bo->destroy = destroy; |