diff options
author | Seema Khowala <seemaj@nvidia.com> | 2018-02-27 18:13:59 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-03-06 01:22:33 -0500 |
commit | c2d01257d79e52a6f4e0ae4335df1b125284accf (patch) | |
tree | a691151f50435154cdb132de6d042f6680808ffe /drivers/gpu/nvgpu/common/linux | |
parent | 963fac80687c1e7d8941a281cace3ccdcc34fc68 (diff) |
gpu: nvgpu: WARN_ON dma_alloc if mem is already valid
Trying to alloc mem for already valid mem will dump warn
stack along with nvgpu warn message for memory leak.
Bug 200393029
Change-Id: I9b5becf898deb47eecd6369c2a97e688caa4660e
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1665377
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/dma.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/dma.c b/drivers/gpu/nvgpu/common/linux/dma.c index c13dae8b..c111d22b 100644 --- a/drivers/gpu/nvgpu/common/linux/dma.c +++ b/drivers/gpu/nvgpu/common/linux/dma.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -221,6 +221,11 @@ int nvgpu_dma_alloc_flags_sys(struct gk20a *g, unsigned long flags, | |||
221 | NVGPU_DEFINE_DMA_ATTRS(dma_attrs); | 221 | NVGPU_DEFINE_DMA_ATTRS(dma_attrs); |
222 | void *alloc_ret; | 222 | void *alloc_ret; |
223 | 223 | ||
224 | if (nvgpu_mem_is_valid(mem)) { | ||
225 | nvgpu_warn(g, "memory leak !!"); | ||
226 | WARN_ON(1); | ||
227 | } | ||
228 | |||
224 | /* | 229 | /* |
225 | * Before the debug print so we see this in the total. But during | 230 | * Before the debug print so we see this in the total. But during |
226 | * cleanup in the fail path this has to be subtracted. | 231 | * cleanup in the fail path this has to be subtracted. |
@@ -297,6 +302,11 @@ int nvgpu_dma_alloc_flags_vid_at(struct gk20a *g, unsigned long flags, | |||
297 | &g->mm.vidmem.bootstrap_allocator; | 302 | &g->mm.vidmem.bootstrap_allocator; |
298 | int before_pending; | 303 | int before_pending; |
299 | 304 | ||
305 | if (nvgpu_mem_is_valid(mem)) { | ||
306 | nvgpu_warn(g, "memory leak !!"); | ||
307 | WARN_ON(1); | ||
308 | } | ||
309 | |||
300 | dma_dbg_alloc(g, size, flags, "vidmem"); | 310 | dma_dbg_alloc(g, size, flags, "vidmem"); |
301 | 311 | ||
302 | mem->size = size; | 312 | mem->size = size; |