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:
Jordan Crouse
2011-05-18 17:09:05 -06:00
committed by Stephen Boyd
parent 05019c4010
commit ad6baf2b9e

View File

@@ -237,16 +237,13 @@ unsigned long allocate_contiguous_memory_nomap(unsigned long size,
int log_align = ilog2(align);
mpool = mem_type_to_memory_pool(mem_type);
if (!mpool)
return -EINVAL;
if (!mpool->gpool)
return -EAGAIN;
if (!mpool || !mpool->gpool)
return 0;
aligned_size = PFN_ALIGN(size);
paddr = gen_pool_alloc_aligned(mpool->gpool, aligned_size, log_align);
if (!paddr)
return -EAGAIN;
return 0;
node = kmalloc(sizeof(struct alloc), GFP_KERNEL);
if (!node)
@@ -273,7 +270,7 @@ out_kfree:
kfree(node);
out:
gen_pool_free(mpool->gpool, paddr, aligned_size);
return -ENOMEM;
return 0;
}
EXPORT_SYMBOL_GPL(allocate_contiguous_memory_nomap);