Commit dd1a8b6b 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 e6e799a9
...@@ -721,8 +721,8 @@ int messageq_open(char *name, u32 *queue_id) ...@@ -721,8 +721,8 @@ int messageq_open(char *name, u32 *queue_id)
len = nameserver_get(messageq_state.ns_handle, name, queue_id, len = nameserver_get(messageq_state.ns_handle, name, queue_id,
sizeof(u32), NULL); sizeof(u32), NULL);
if (len <= 0) { if (len < 0) {
/* Name found */ /* Name not found */
status = MESSAGEQ_E_FAIL; status = MESSAGEQ_E_FAIL;
} }
......
...@@ -797,13 +797,12 @@ int nameserver_get(void *handle, const char *name, ...@@ -797,13 +797,12 @@ int nameserver_get(void *handle, const char *name,
struct nameserver_object *temp_obj = NULL; struct nameserver_object *temp_obj = NULL;
u16 max_proc_id; u16 max_proc_id;
u16 local_proc_id; u16 local_proc_id;
s32 retval = -1; s32 retval = -ENOENT;
u32 i; u32 i;
BUG_ON(handle == NULL); BUG_ON(handle == NULL);
BUG_ON(name == NULL); BUG_ON(name == NULL);
BUG_ON(buffer == NULL); BUG_ON(buffer == NULL);
BUG_ON(proc_id == NULL);
if (WARN_ON(length == 0)) { if (WARN_ON(length == 0)) {
retval = -EINVAL; retval = -EINVAL;
goto exit; goto exit;
...@@ -823,7 +822,7 @@ int nameserver_get(void *handle, const char *name, ...@@ -823,7 +822,7 @@ int nameserver_get(void *handle, const char *name,
if (i == local_proc_id) if (i == local_proc_id)
continue; continue;
retval = nameserver_remote_get( retval = nameserver_remote_get(
nameserver_state.remote_handle_list[proc_id[i]], nameserver_state.remote_handle_list[i],
temp_obj->name, name, buffer, length); temp_obj->name, name, buffer, length);
if (retval == 0) /* Got the value */ if (retval == 0) /* Got the value */
break; break;
...@@ -846,12 +845,10 @@ int nameserver_get(void *handle, const char *name, ...@@ -846,12 +845,10 @@ int nameserver_get(void *handle, const char *name,
retval = nameserver_remote_get( retval = nameserver_remote_get(
nameserver_state.remote_handle_list[proc_id[i]], nameserver_state.remote_handle_list[proc_id[i]],
temp_obj->name, name, buffer, length); temp_obj->name, name, buffer, length);
/* A count of non-zero means it was found */
if (retval == 0) if (retval == 0)
break; break;
} }
} }
retval = -ENOENT;
exit: exit:
printk(KERN_ERR "nameserver_get_local failed status:%x \n", retval); 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, ...@@ -30,7 +30,7 @@ int nameserver_remote_get(const struct nameserver_remote_object *handle,
void *value, u32 value_len) void *value, u32 value_len)
{ {
s32 retval = 0; s32 retval = 0;
s32 count = 0;
gt_0trace(ns_debugmask, GT_ENTER, "nameserver_remote_get\n"); gt_0trace(ns_debugmask, GT_ENTER, "nameserver_remote_get\n");
if (handle == NULL || instance_name == NULL || if (handle == NULL || instance_name == NULL ||
...@@ -44,8 +44,7 @@ int nameserver_remote_get(const struct nameserver_remote_object *handle, ...@@ -44,8 +44,7 @@ int nameserver_remote_get(const struct nameserver_remote_object *handle,
goto exit; goto exit;
} }
count = handle->get(handle, instance_name, name, value, value_len); retval = handle->get(handle, instance_name, name, value, value_len);
return count;
exit: exit:
return retval; return retval;
......
...@@ -350,7 +350,7 @@ int nameserver_remotenotify_get(void *rhandle, ...@@ -350,7 +350,7 @@ int nameserver_remotenotify_get(void *rhandle,
BUG_ON(name == NULL); BUG_ON(name == NULL);
BUG_ON(value == NULL); BUG_ON(value == NULL);
if (WARN_ON(handle == NULL)) { if (WARN_ON(rhandle == NULL)) {
retval = -EINVAL; retval = -EINVAL;
goto exit; goto exit;
} }
...@@ -513,7 +513,7 @@ void *nameserver_remotenotify_create(u16 proc_id, ...@@ -513,7 +513,7 @@ void *nameserver_remotenotify_create(u16 proc_id,
params->notify_event_no, params->notify_event_no,
nameserver_remotenotify_callback, nameserver_remotenotify_callback,
(void *)obj); (void *)obj);
if (retval) { if (retval < 0) {
gt_0trace(nameserver_remotenotify_mask, GT_6CLASS, gt_0trace(nameserver_remotenotify_mask, GT_6CLASS,
"nameserver_remotenotify_create: notify register" "nameserver_remotenotify_create: notify register"
"events failed!\n"); "events failed!\n");
...@@ -527,7 +527,7 @@ void *nameserver_remotenotify_create(u16 proc_id, ...@@ -527,7 +527,7 @@ void *nameserver_remotenotify_create(u16 proc_id,
goto sem_alloc_error; 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? */ /* its is at the end since its init state = unlocked? */
mutex_init(obj->local_gate); 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