From a63e7151172d53024c8057c90fda06124d34a618 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Tue, 23 Jan 2018 15:41:36 -0800 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1644802 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Arun Kannan Reviewed-by: Seshendra Gadagottu Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/kmem.c | 6 +++--- 1 file 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) * nvgpu_big_[mz]alloc() will need to remember the size of the alloc * when freeing. */ - if (virt_addr_valid(p)) - nvgpu_kfree(g, p); - else + if (is_vmalloc_addr(p)) nvgpu_vfree(g, p); + else + nvgpu_kfree(g, p); } void *__nvgpu_kmalloc(struct gk20a *g, size_t size, unsigned long ip) -- cgit v1.2.2