- Add stub ptr check to the deregistration function
- Change function call to g_rec_mutex_clear() in the registeration function
Change-Id: I360083e4404e7935dd63eabbba540b3901ee9cd8
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
ret = rpc_port_stub_create(&__<NAME>.stub, "<NAME>");
if (ret != RPC_PORT_ERROR_NONE) {
_E("Failed to create stub handle. error(%d)", ret);
- <PREFIX>_<NAME>_unregister();
+ g_rec_mutex_clear(&__<NAME>.mutex);
return ret;
}
int <PREFIX>_<NAME>_unregister(void)
{
+ if (__<NAME>.stub == nullptr)
+ return RPC_PORT_ERROR_NONE;
+
g_rec_mutex_lock(&__<NAME>.mutex);
g_rec_mutex_unlock(&__<NAME>.mutex);
g_rec_mutex_clear(&__<NAME>.mutex);