From 5eceb5d55659733a96bda7aab17c00f5485addff Mon Sep 17 00:00:00 2001
From: Jayan John <x00jayan@ti.com>
Date: Wed, 29 Jul 2009 18:26:11 +0530
Subject: [PATCH] SYSLINK: ipc - fix messageq create and delete

This patch fixes messageq_create and delete functions.
It removes the BUG_ON check for NULL name in message_create.
In messageq_delete, it removes name from nameserver and frees
memory for name only if name is not NULL.

Signed-off-by: Jayan John <x00jayan@ti.com>
---
 drivers/dsp/syslink/multicore_ipc/messageq.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
 mode change 100755 => 100644 drivers/dsp/syslink/multicore_ipc/messageq.c

diff --git a/drivers/dsp/syslink/multicore_ipc/messageq.c b/drivers/dsp/syslink/multicore_ipc/messageq.c
old mode 100755
new mode 100644
index 529bb682c9b..afcb9adaf8c
--- a/drivers/dsp/syslink/multicore_ipc/messageq.c
+++ b/drivers/dsp/syslink/multicore_ipc/messageq.c
@@ -557,7 +557,6 @@ void *messageq_create(char *name, const struct messageq_params *params)
 
 	gt_2trace(messageq_dbgmask, GT_ENTER, "messageq_create", name, params);
 
-	BUG_ON(name == NULL);
 	BUG_ON(params == NULL);
 	if (atomic_cmpmask_and_lt(&(messageq_state.ref_count),
 				MESSAGEQ_MAKE_MAGICSTAMP(0),
@@ -711,12 +710,14 @@ int messageq_delete(void **msg_handleptr)
 
 	/* Take the local lock */
 	key = mutex_lock_interruptible(messageq_state.gate_handle);
-	/* remove from the name serve */
-	nameserver_remove(messageq_state.ns_handle, handle->name);
+
 	if (handle->name != NULL) {
+		/* remove from the name serve */
+		nameserver_remove(messageq_state.ns_handle, handle->name);
 		/* Free memory for the name */
 		kfree(handle->name);
 	}
+
 	/* Release the local lock */
 	mutex_unlock(messageq_state.gate_handle);
 
-- 
2.25.4