summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/exynos/exynos_drm_buf.c
diff options
context:
space:
mode:
authorPrathyush K <prathyush.k@samsung.com>2012-11-20 14:32:56 +0400
committerInki Dae <inki.dae@samsung.com>2012-12-05 09:39:20 +0400
commit465ed6606018b56d55219b6c58a7b98793d8cbcc (patch)
tree974610e76ec23feef25f873cbe4441b319154214 /drivers/gpu/drm/exynos/exynos_drm_buf.c
parentdd265850f10a16e4525ed002f0173a1acd8c8876 (diff)
downloadlinux-465ed6606018b56d55219b6c58a7b98793d8cbcc.tar.xz
drm/exynos: remove 'pages' and 'page_size' elements in exynos gem buffer
Changelog v2: Removed redundant check for invalid sgl. Added check for valid page_offset in the beginning of exynos_drm_gem_map_buf. Changelog v1: The 'pages' structure is not required since we can use the 'sgt'. Even for CONTIG buffers, a SGT is created (which will have just one sgl). This SGT can be used during mmap instead of 'pages'. The 'page_size' element of the structure is also not used anywhere and is removed. This patch also fixes a memory leak where the 'pages' structure was being allocated during gem buffer allocation but not being freed during deallocate. Signed-off-by: Prathyush K <prathyush.k@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Diffstat (limited to 'drivers/gpu/drm/exynos/exynos_drm_buf.c')
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_buf.c20
1 files changed, 0 insertions, 20 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c
index 48c589661cbe..72bf97b96ba0 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_buf.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c
@@ -34,8 +34,6 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
unsigned int flags, struct exynos_drm_gem_buf *buf)
{
int ret = 0;
- unsigned int npages, i = 0;
- struct scatterlist *sgl;
enum dma_attr attr = DMA_ATTR_FORCE_CONTIGUOUS;
DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -73,22 +71,6 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
goto err_free_sgt;
}
- npages = buf->sgt->nents;
-
- buf->pages = kzalloc(sizeof(struct page) * npages, GFP_KERNEL);
- if (!buf->pages) {
- DRM_ERROR("failed to allocate pages.\n");
- ret = -ENOMEM;
- goto err_free_table;
- }
-
- sgl = buf->sgt->sgl;
- while (i < npages) {
- buf->pages[i] = sg_page(sgl);
- sgl = sg_next(sgl);
- i++;
- }
-
DRM_DEBUG_KMS("vaddr(0x%lx), dma_addr(0x%lx), size(0x%lx)\n",
(unsigned long)buf->kvaddr,
(unsigned long)buf->dma_addr,
@@ -96,8 +78,6 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
return ret;
-err_free_table:
- sg_free_table(buf->sgt);
err_free_sgt:
kfree(buf->sgt);
buf->sgt = NULL;