* [patch] drm/tegra: gem: oops in error handling
@ 2015-01-16 10:43 Dan Carpenter
2015-01-16 11:12 ` Thierry Reding
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-01-16 10:43 UTC (permalink / raw)
To: Thierry Reding
Cc: Alexandre Courbot, Terje Bergström, Stephen Warren,
kernel-janitors, dri-devel, linux-tegra
kfree(ERR_PTR(-ENOMEM)) will not work very well.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index 8777b7f..28215e4 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -244,10 +244,8 @@ static int tegra_bo_get_pages(struct drm_device *drm, struct tegra_bo *bo)
for_each_sg(sgt->sgl, s, sgt->nents, i)
sg_dma_address(s) = sg_phys(s);
- if (dma_map_sg(drm->dev, sgt->sgl, sgt->nents, DMA_TO_DEVICE) = 0) {
- sgt = ERR_PTR(-ENOMEM);
+ if (dma_map_sg(drm->dev, sgt->sgl, sgt->nents, DMA_TO_DEVICE) = 0)
goto release_sgt;
- }
bo->sgt = sgt;
@@ -256,6 +254,7 @@ static int tegra_bo_get_pages(struct drm_device *drm, struct tegra_bo *bo)
release_sgt:
sg_free_table(sgt);
kfree(sgt);
+ sgt = ERR_PTR(-ENOMEM);
put_pages:
drm_gem_put_pages(&bo->gem, bo->pages, false, false);
return PTR_ERR(sgt);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] drm/tegra: gem: oops in error handling
2015-01-16 10:43 [patch] drm/tegra: gem: oops in error handling Dan Carpenter
@ 2015-01-16 11:12 ` Thierry Reding
0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2015-01-16 11:12 UTC (permalink / raw)
To: Dan Carpenter
Cc: Terje Bergström, David Airlie, Stephen Warren,
Alexandre Courbot, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 210 bytes --]
On Fri, Jan 16, 2015 at 01:43:42PM +0300, Dan Carpenter wrote:
> kfree(ERR_PTR(-ENOMEM)) will not work very well.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thanks.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-16 11:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-16 10:43 [patch] drm/tegra: gem: oops in error handling Dan Carpenter
2015-01-16 11:12 ` Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).