[PATCH] drm/amdgpu: fix memory leak in psp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 28, 2017 at 05:16:09PM +0800, Ken Wang wrote:
> Change-Id: I6bea247f41ea405d11c1d75ca97b789f6970b191
> Signed-off-by: Ken Wang <Qingqing.Wang at amd.com>

Reviewed-by: Huang Rui <ray.huang at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index 89d1d2f..4731015f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -132,6 +132,10 @@ psp_cmd_submit_buf(struct psp_context *psp,
>  		msleep(1);
>  	};
>  
> +	amdgpu_bo_free_kernel(&cmd_buf_bo,
> +			      &cmd_buf_mc_addr,
> +			      (void **)&cmd_buf_mem);
> +
>  	return ret;
>  }
>  
> @@ -174,6 +178,8 @@ static int psp_tmr_init(struct psp_context *psp)
>  	if (ret)
>  		goto failed_mem;
>  
> +	kfree(cmd);
> +
>  	return 0;
>  
>  failed_mem:
> @@ -241,6 +247,7 @@ static int psp_asd_load(struct psp_context *psp)
>  
>  	amdgpu_bo_free_kernel(&asd_bo, &asd_mc_addr, &asd_buf);
>  	amdgpu_bo_free_kernel(&asd_shared_bo, &asd_shared_mc_addr, &asd_shared_buf);
> +	kfree(cmd);
>  
>  	return 0;
>  
> @@ -289,11 +296,11 @@ static int psp_load_fw(struct amdgpu_device *adev)
>  
>  	ret = psp_tmr_init(psp);
>  	if (ret)
> -		goto failed;
> +		goto failed_mem;
>  
>  	ret = psp_asd_load(psp);
>  	if (ret)
> -		goto failed;
> +		goto failed_mem;
>  
>  	for (i = 0; i < adev->firmware.max_ucodes; i++) {
>  		ucode = &adev->firmware.ucode[i];
> @@ -322,6 +329,7 @@ static int psp_load_fw(struct amdgpu_device *adev)
>  
>  	amdgpu_bo_free_kernel(&psp->fence_buf_bo,
>  			      &psp->fence_buf_mc_addr, &psp->fence_buf);
> +	kfree(cmd);
>  
>  	return 0;
>  
> -- 
> 2.7.4
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux