Commit 5d26f691 authored by Jayan John's avatar Jayan John Committed by Hari Kanigeri

SYSLINK: ipc - minor fix in heapbuf

This patch fixes the minor issues found in heapbuf.c. heapbuf_alloc() now returns failure status for all failures. Earlier we had 0 returned in the case of some failures.
Signed-off-by: default avatarJayan John <x00jayan@ti.com>
parent 9ab6ce53
......@@ -868,22 +868,29 @@ void *heapbuf_alloc(void *hphandle, u32 size, u32 align)
goto error;
}
if (WARN_ON(hphandle == NULL))
if (WARN_ON(hphandle == NULL)) {
retval = -EINVAL;
goto error;
}
if (WARN_ON(size == 0))
if (WARN_ON(size == 0)) {
retval = -EINVAL;
goto error;
}
handle = (struct heap_object *)(hphandle);
obj = (struct heapbuf_obj *)handle->obj;
if ((obj->params.exact == true)
&& (size != obj->attrs->block_size))
&& (size != obj->attrs->block_size)) {
retval = -EINVAL;
goto error;
}
if (size > obj->attrs->block_size)
if (size > obj->attrs->block_size) {
retval = -EINVAL;
goto error;
}
if (likely(obj->gate != NULL)) {
status = gatepeterson_enter(obj->gate);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment