lib: Remove negative error values from allocate_contiguous_memory_nomap
allocate_contiguous_memory_nomap returns an unsigned long yet it was returning errno codes for various failures. Replace all negative errno codes with 0, which is what all the callers expect on error anyway. Change-Id: I3f847f70e0d7fa947a3442f43a980b3ffb1bfd96 Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> (cherry picked from commit f319151ecf9bdb51295ddbf6ac8385f63fd4ae70)
This commit is contained in:
committed by
Stephen Boyd
parent
05019c4010
commit
ad6baf2b9e
@@ -237,16 +237,13 @@ unsigned long allocate_contiguous_memory_nomap(unsigned long size,
|
|||||||
int log_align = ilog2(align);
|
int log_align = ilog2(align);
|
||||||
|
|
||||||
mpool = mem_type_to_memory_pool(mem_type);
|
mpool = mem_type_to_memory_pool(mem_type);
|
||||||
if (!mpool)
|
if (!mpool || !mpool->gpool)
|
||||||
return -EINVAL;
|
return 0;
|
||||||
|
|
||||||
if (!mpool->gpool)
|
|
||||||
return -EAGAIN;
|
|
||||||
|
|
||||||
aligned_size = PFN_ALIGN(size);
|
aligned_size = PFN_ALIGN(size);
|
||||||
paddr = gen_pool_alloc_aligned(mpool->gpool, aligned_size, log_align);
|
paddr = gen_pool_alloc_aligned(mpool->gpool, aligned_size, log_align);
|
||||||
if (!paddr)
|
if (!paddr)
|
||||||
return -EAGAIN;
|
return 0;
|
||||||
|
|
||||||
node = kmalloc(sizeof(struct alloc), GFP_KERNEL);
|
node = kmalloc(sizeof(struct alloc), GFP_KERNEL);
|
||||||
if (!node)
|
if (!node)
|
||||||
@@ -273,7 +270,7 @@ out_kfree:
|
|||||||
kfree(node);
|
kfree(node);
|
||||||
out:
|
out:
|
||||||
gen_pool_free(mpool->gpool, paddr, aligned_size);
|
gen_pool_free(mpool->gpool, paddr, aligned_size);
|
||||||
return -ENOMEM;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(allocate_contiguous_memory_nomap);
|
EXPORT_SYMBOL_GPL(allocate_contiguous_memory_nomap);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user