aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-01-16 05:43:42 -0500
committerThierry Reding <treding@nvidia.com>2015-01-27 04:14:41 -0500
commit2cb207e413a9ace502edbce51c604e2088b0acb2 (patch)
treef5dd70fc51950300a392d73fdb29fbb327ca4744 /drivers
parent8643bc6d8e3701734a86d2ae2da32bbfaf1d4535 (diff)
drm/tegra: gem: oops in error handling
kfree(ERR_PTR(-ENOMEM)) will not work very well. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/tegra/gem.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index 1ccde09d01c8..cfb481943b6b 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -214,10 +214,8 @@ static int tegra_bo_get_pages(struct drm_device *drm, struct tegra_bo *bo)
214 for_each_sg(sgt->sgl, s, sgt->nents, i) 214 for_each_sg(sgt->sgl, s, sgt->nents, i)
215 sg_dma_address(s) = sg_phys(s); 215 sg_dma_address(s) = sg_phys(s);
216 216
217 if (dma_map_sg(drm->dev, sgt->sgl, sgt->nents, DMA_TO_DEVICE) == 0) { 217 if (dma_map_sg(drm->dev, sgt->sgl, sgt->nents, DMA_TO_DEVICE) == 0)
218 sgt = ERR_PTR(-ENOMEM);
219 goto release_sgt; 218 goto release_sgt;
220 }
221 219
222 bo->sgt = sgt; 220 bo->sgt = sgt;
223 221
@@ -226,6 +224,7 @@ static int tegra_bo_get_pages(struct drm_device *drm, struct tegra_bo *bo)
226release_sgt: 224release_sgt:
227 sg_free_table(sgt); 225 sg_free_table(sgt);
228 kfree(sgt); 226 kfree(sgt);
227 sgt = ERR_PTR(-ENOMEM);
229put_pages: 228put_pages:
230 drm_gem_put_pages(&bo->gem, bo->pages, false, false); 229 drm_gem_put_pages(&bo->gem, bo->pages, false, false);
231 return PTR_ERR(sgt); 230 return PTR_ERR(sgt);