Commit 4bb615c5 authored by Seung-Woo Kim's avatar Seung-Woo Kim Committed by Inki Dae

drm/exynos: remove duplicated error routine and unnecessary assign

There were duplicated error handling routines during allocating
pages in lowlevel_buffer_allocate() and g2d_userptr_get_dma_addr().
Also unnecessary NULL assignments for variable used not any more
are removed from g2d_userptr_get_dma_addr() and
g2d_userptr_put_dma_addr().
Signed-off-by: default avatarSeung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: default avatarYoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 42ac99a7
...@@ -68,8 +68,8 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, ...@@ -68,8 +68,8 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
&buf->dma_attrs); &buf->dma_attrs);
if (!buf->kvaddr) { if (!buf->kvaddr) {
DRM_ERROR("failed to allocate buffer.\n"); DRM_ERROR("failed to allocate buffer.\n");
drm_free_large(buf->pages); ret = -ENOMEM;
return -ENOMEM; goto err_free;
} }
start_addr = buf->dma_addr; start_addr = buf->dma_addr;
...@@ -106,7 +106,7 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, ...@@ -106,7 +106,7 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
dma_free_attrs(dev->dev, buf->size, buf->pages, dma_free_attrs(dev->dev, buf->size, buf->pages,
(dma_addr_t)buf->dma_addr, &buf->dma_attrs); (dma_addr_t)buf->dma_addr, &buf->dma_attrs);
buf->dma_addr = (dma_addr_t)NULL; buf->dma_addr = (dma_addr_t)NULL;
err_free:
if (!is_drm_iommu_supported(dev)) if (!is_drm_iommu_supported(dev))
drm_free_large(buf->pages); drm_free_large(buf->pages);
......
...@@ -388,12 +388,9 @@ static void g2d_userptr_put_dma_addr(struct drm_device *drm_dev, ...@@ -388,12 +388,9 @@ static void g2d_userptr_put_dma_addr(struct drm_device *drm_dev,
sg_free_table(g2d_userptr->sgt); sg_free_table(g2d_userptr->sgt);
kfree(g2d_userptr->sgt); kfree(g2d_userptr->sgt);
g2d_userptr->sgt = NULL;
drm_free_large(g2d_userptr->pages); drm_free_large(g2d_userptr->pages);
g2d_userptr->pages = NULL;
kfree(g2d_userptr); kfree(g2d_userptr);
g2d_userptr = NULL;
} }
static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev,
...@@ -466,8 +463,8 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, ...@@ -466,8 +463,8 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev,
pages = drm_calloc_large(npages, sizeof(struct page *)); pages = drm_calloc_large(npages, sizeof(struct page *));
if (!pages) { if (!pages) {
DRM_ERROR("failed to allocate pages.\n"); DRM_ERROR("failed to allocate pages.\n");
kfree(g2d_userptr); ret = -ENOMEM;
return ERR_PTR(-ENOMEM); goto err_free;
} }
vma = find_vma(current->mm, userptr); vma = find_vma(current->mm, userptr);
...@@ -543,7 +540,6 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, ...@@ -543,7 +540,6 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev,
err_free_sgt: err_free_sgt:
kfree(sgt); kfree(sgt);
sgt = NULL;
err_free_userptr: err_free_userptr:
exynos_gem_put_pages_to_userptr(g2d_userptr->pages, exynos_gem_put_pages_to_userptr(g2d_userptr->pages,
...@@ -555,9 +551,9 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, ...@@ -555,9 +551,9 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev,
err_free_pages: err_free_pages:
drm_free_large(pages); drm_free_large(pages);
err_free:
kfree(g2d_userptr); kfree(g2d_userptr);
pages = NULL;
g2d_userptr = NULL;
return ERR_PTR(ret); return ERR_PTR(ret);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment