Commit 402e6a25 authored by Suman Anna's avatar Suman Anna Committed by Hari Kanigeri

SYSLINK: ipc - decrement reference count properly.

This patch fixes the WARN_ON issue with the nameserver_destroy
function due to incorrect maintainance of the module state
reference count. This patch also includes minor code cleanup
changes.
Signed-off-by: default avatarSuman Anna <s-anna@ti.com>
parent e7090ae3
......@@ -239,7 +239,7 @@ int nameserver_setup(void)
if (atomic_inc_return(&nameserver_state.ref_count)
!= NAMESERVER_MAKE_MAGICSTAMP(1)) {
retval = -EEXIST;
goto error;
goto exit;
}
nr_procs = multiproc_get_max_processors();
......@@ -265,6 +265,7 @@ int nameserver_setup(void)
error:
kfree(list);
printk(KERN_ERR "nameserver_setup failed, retval: %x\n", retval);
exit:
return retval;
}
EXPORT_SYMBOL(nameserver_setup);
......@@ -284,7 +285,7 @@ int nameserver_destroy(void)
NAMESERVER_MAKE_MAGICSTAMP(1)) == true)) {
retval = -ENODEV;
goto exit;
}
}
if (WARN_ON(nameserver_state.list_lock == NULL)) {
retval = -ENODEV;
......@@ -297,6 +298,12 @@ int nameserver_destroy(void)
goto exit;
}
if (!(atomic_dec_return(&nameserver_state.ref_count)
== NAMESERVER_MAKE_MAGICSTAMP(0))) {
retval = -EBUSY;
goto exit;
}
retval = mutex_lock_interruptible(nameserver_state.list_lock);
if (retval)
goto exit;
......
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