gpu: nvgpu: fix malloc return check in POSIX kmem

This fixes a bug in nvgpu_kmem_cache_create() where the return of
malloc() was incorrectly checked.

Bug found as a result of JIRA NVGPU-1235

Change-Id: I1c80f2035df980fd1193cf60dfe6132c1f9b693d
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1919442
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Philip Elcan
2018-10-04 13:10:28 -04:00
committed by mobile promotions
parent eeff8bf356
commit 9fda4bc276

View File

@@ -41,7 +41,7 @@ struct nvgpu_kmem_cache *nvgpu_kmem_cache_create(struct gk20a *g, size_t size)
struct nvgpu_kmem_cache *cache =
malloc(sizeof(struct nvgpu_kmem_cache));
if (cache != NULL)
if (cache == NULL)
return NULL;
cache->alloc_size = size;