diff options
author | Sam Nelson <sam.nelson@ti.com> | 2016-11-11 16:55:06 -0500 |
---|---|---|
committer | Sam Nelson <sam.nelson@ti.com> | 2016-11-15 10:52:06 -0500 |
commit | bd9c31cae31bd039deb496165b2749a1f66cd016 (patch) | |
tree | 7cc0658f48aa6b853af82985d1b861c7bf800049 | |
parent | d0f1b49b736561c82c6dee330f1042331c6fee4e (diff) | |
download | linuxutils-bd9c31cae31bd039deb496165b2749a1f66cd016.tar.gz |
cmemk: Add error check for ioremap function call
Added error check for ioremap_page_range in case of failure
Also added initialisation of virtp
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
-rw-r--r-- | src/cmem/module/cmemk.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/cmem/module/cmemk.c b/src/cmem/module/cmemk.c index e65c3d0..014944c 100644 --- a/src/cmem/module/cmemk.c +++ b/src/cmem/module/cmemk.c @@ -344,8 +344,13 @@ static int map_header(void **vaddrp, phys_addr_t physp, struct vm_struct **vm) } vaddr = (unsigned long)(*vm)->addr; - ioremap_page_range((unsigned long)vaddr, (unsigned long)vaddr + PAGE_SIZE, - physp, PAGE_KERNEL); + if(ioremap_page_range((unsigned long)vaddr, (unsigned long)vaddr + PAGE_SIZE, + physp, PAGE_KERNEL)) { + __E("ioremap_page_range() failed\n"); + free_vm_area(*vm); + *vm = NULL; + return -ENOMEM; + } *vaddrp = (*vm)->addr; __D("map_header: ioremap_page_range(%#llx, %#lx)=0x%p\n", @@ -1074,6 +1079,7 @@ static int alloc_pool(int bi, int idx, int num, unsigned long long reqsize, phys entry->id = i; entry->physp = physp; entry->size = size; + entry->kvirtp = NULL; INIT_LIST_HEAD(&entry->users); if (physpRet) { @@ -1205,7 +1211,7 @@ alloc: } else { physp = HeapMem_alloc(bi, size, align, ALLOCRUN); - + entry->kvirtp = NULL; /* set only for test just below here */ virtp = (void *)(unsigned int)physp; } |