From: Ben Skeggs Date: Tue, 17 Sep 2013 04:13:32 +0000 (+1000) Subject: drm/nouveau/ttm: prevent double-free in nouveau_sgdma_create_ttm() failure path X-Git-Tag: upstream/snapshot3+hdmi~4081^2~13^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a59cc34a3d7b97a00829613bb1a630f5004643b;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git drm/nouveau/ttm: prevent double-free in nouveau_sgdma_create_ttm() failure path TTM calls the destructor on its own already... Signed-off-by: Ben Skeggs --- diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index ca5492a..0843ebc 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c @@ -104,9 +104,7 @@ nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev, else nvbe->ttm.ttm.func = &nv50_sgdma_backend; - if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page)) { - kfree(nvbe); + if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page)) return NULL; - } return &nvbe->ttm.ttm; }