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>
Este commit está contenido en:
Thomas Hellstrom
2010-11-09 21:31:44 +01:00
cometido por Dave Airlie
padre 2b66b50b12
commit 7dfbbdcffe
Se han modificado 2 ficheros con 8 adiciones y 0 borrados

Ver fichero

@@ -1144,6 +1144,10 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
if (num_pages == 0) {
printk(KERN_ERR TTM_PFX "Illegal buffer object size.\n");
if (destroy)
(*destroy)(bo);
else
kfree(bo);
return -EINVAL;
}
bo->destroy = destroy;