Commit 04825197 authored by Jayan John's avatar Jayan John Committed by Hari Kanigeri

Syslink: Patch to resolve issues in IPC components nameserver, nameserver notify and messageQ.

This patch resolves issues in nameserver, nameserver remote, nameserver remote notify and messageQ. The fixes mainly involve correction of arg checks, status returns and status checks. These changes are necessary for MessageQ to work.
Signed-off-by: default avatarJayan John <x00jayan@ti.com>
parent e656333c
......@@ -721,8 +721,8 @@ int messageq_open(char *name, u32 *queue_id)
len = nameserver_get(messageq_state.ns_handle, name, queue_id,
sizeof(u32), NULL);
if (len <= 0) {
/* Name found */
if (len < 0) {
/* Name not found */
status = MESSAGEQ_E_FAIL;
}
......
......@@ -797,13 +797,12 @@ int nameserver_get(void *handle, const char *name,
struct nameserver_object *temp_obj = NULL;
u16 max_proc_id;
u16 local_proc_id;
s32 retval = -1;
s32 retval = -ENOENT;
u32 i;
BUG_ON(handle == NULL);
BUG_ON(name == NULL);
BUG_ON(buffer == NULL);
BUG_ON(proc_id == NULL);
if (WARN_ON(length == 0)) {
retval = -EINVAL;
goto exit;
......@@ -823,7 +822,7 @@ int nameserver_get(void *handle, const char *name,
if (i == local_proc_id)
continue;
retval = nameserver_remote_get(
nameserver_state.remote_handle_list[proc_id[i]],
nameserver_state.remote_handle_list[i],
temp_obj->name, name, buffer, length);
if (retval == 0) /* Got the value */
break;
......@@ -846,12 +845,10 @@ int nameserver_get(void *handle, const char *name,
retval = nameserver_remote_get(
nameserver_state.remote_handle_list[proc_id[i]],
temp_obj->name, name, buffer, length);
/* A count of non-zero means it was found */
if (retval == 0)
break;
}
}
retval = -ENOENT;
exit:
printk(KERN_ERR "nameserver_get_local failed status:%x \n", retval);
......
......@@ -30,7 +30,7 @@ int nameserver_remote_get(const struct nameserver_remote_object *handle,
void *value, u32 value_len)
{
s32 retval = 0;
s32 count = 0;
gt_0trace(ns_debugmask, GT_ENTER, "nameserver_remote_get\n");
if (handle == NULL || instance_name == NULL ||
......@@ -44,8 +44,7 @@ int nameserver_remote_get(const struct nameserver_remote_object *handle,
goto exit;
}
count = handle->get(handle, instance_name, name, value, value_len);
return count;
retval = handle->get(handle, instance_name, name, value, value_len);
exit:
return retval;
......
......@@ -350,7 +350,7 @@ int nameserver_remotenotify_get(void *rhandle,
BUG_ON(name == NULL);
BUG_ON(value == NULL);
if (WARN_ON(handle == NULL)) {
if (WARN_ON(rhandle == NULL)) {
retval = -EINVAL;
goto exit;
}
......@@ -513,7 +513,7 @@ void *nameserver_remotenotify_create(u16 proc_id,
params->notify_event_no,
nameserver_remotenotify_callback,
(void *)obj);
if (retval) {
if (retval < 0) {
gt_0trace(nameserver_remotenotify_mask, GT_6CLASS,
"nameserver_remotenotify_create: notify register"
"events failed!\n");
......@@ -527,7 +527,7 @@ void *nameserver_remotenotify_create(u16 proc_id,
goto sem_alloc_error;
}
sema_init(obj->sem_handle, 1);
sema_init(obj->sem_handle, 0);
/* its is at the end since its init state = unlocked? */
mutex_init(obj->local_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