diff options
author | Alex Waterman <alexw@nvidia.com> | 2018-01-23 18:41:36 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-01-24 17:42:42 -0500 |
commit | a63e7151172d53024c8057c90fda06124d34a618 (patch) | |
tree | 8d5a03718d5f12860de65b4daa78c83eb225054d /drivers/gpu/nvgpu/common/linux | |
parent | 7bd1c4640ca37ef621a11b7bbabe2ead86dff87b (diff) |
gpu: nvgpu: Smarter way to check vmalloc address
In the nvgpu_big_free() function the passed in address is checked
to see what type of address it is: kmalloc or vmalloc. This change
uses the is_vmalloc_addr() instead since this is a much clearer and
easier way to determine if a virtual address should be vfree()ed.
Anything not a vmalloc address is then assumed to be a kmalloc()
address.
Bug 2049449
Change-Id: I2bd9441d3c5fc455f03ec2075d012c607280ad5f
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1644802
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Arun Kannan <akannan@nvidia.com>
Reviewed-by: Seshendra Gadagottu <sgadagottu@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/kmem.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/kmem.c b/drivers/gpu/nvgpu/common/linux/kmem.c index a492fb35..10946a08 100644 --- a/drivers/gpu/nvgpu/common/linux/kmem.c +++ b/drivers/gpu/nvgpu/common/linux/kmem.c | |||
@@ -63,10 +63,10 @@ void nvgpu_big_free(struct gk20a *g, void *p) | |||
63 | * nvgpu_big_[mz]alloc() will need to remember the size of the alloc | 63 | * nvgpu_big_[mz]alloc() will need to remember the size of the alloc |
64 | * when freeing. | 64 | * when freeing. |
65 | */ | 65 | */ |
66 | if (virt_addr_valid(p)) | 66 | if (is_vmalloc_addr(p)) |
67 | nvgpu_kfree(g, p); | ||
68 | else | ||
69 | nvgpu_vfree(g, p); | 67 | nvgpu_vfree(g, p); |
68 | else | ||
69 | nvgpu_kfree(g, p); | ||
70 | } | 70 | } |
71 | 71 | ||
72 | void *__nvgpu_kmalloc(struct gk20a *g, size_t size, unsigned long ip) | 72 | void *__nvgpu_kmalloc(struct gk20a *g, size_t size, unsigned long ip) |