diff mbox

nouveau: free the memory in nouveau_gart_manager_del()

Message ID 20110625055324.GS14591@shale.localdomain (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter June 25, 2011, 5:53 a.m. UTC
In the original code the kfree() doesn't do anything because
"mem->mm_node" has been set to NULL.  This was introduced in
d2f96666c56a "drm/nouveau: create temp vmas for both src and dst of
bo moves"

Signed-off-by: Dan Carpenter <error27@gmail.com>

Comments

Ben Skeggs June 25, 2011, 12:01 p.m. UTC | #1
On Sat, 2011-06-25 at 08:53 +0300, Dan Carpenter wrote:
> In the original code the kfree() doesn't do anything because
> "mem->mm_node" has been set to NULL.  This was introduced in
> d2f96666c56a "drm/nouveau: create temp vmas for both src and dst of
> bo moves"
Already fixed in nouveau git, I'll get the fixes to Dave.

Ben.

> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
> index 765f0e5..ab79bf8 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_mem.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
> @@ -846,8 +846,8 @@ nouveau_gart_manager_del(struct ttm_mem_type_manager *man,
>  			 struct ttm_mem_reg *mem)
>  {
>  	nouveau_mem_node_cleanup(mem->mm_node);
> -	mem->mm_node = NULL;
>  	kfree(mem->mm_node);
> +	mem->mm_node = NULL;
>  }
>  
>  static int
diff mbox

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
index 765f0e5..ab79bf8 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -846,8 +846,8 @@  nouveau_gart_manager_del(struct ttm_mem_type_manager *man,
 			 struct ttm_mem_reg *mem)
 {
 	nouveau_mem_node_cleanup(mem->mm_node);
-	mem->mm_node = NULL;
 	kfree(mem->mm_node);
+	mem->mm_node = NULL;
 }
 
 static int