rpmsgfs/rpmsgfs_client: init the priv->wait before register rpmsg callback
Should init the priv->wait before rpmsg_register_callback() because rpmsgfs_ns_bound() may has been called before rpmsg_register_callback() returned. Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
parent
439c52937a
commit
271893ed6d
@ -744,6 +744,7 @@ int rpmsgfs_client_bind(FAR void **handle, FAR const char *cpuname)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
nxsem_init(&priv->wait, 0, 0);
|
||||
strlcpy(priv->cpuname, cpuname, sizeof(priv->cpuname));
|
||||
ret = rpmsg_register_callback(priv,
|
||||
rpmsgfs_device_created,
|
||||
@ -752,11 +753,11 @@ int rpmsgfs_client_bind(FAR void **handle, FAR const char *cpuname)
|
||||
NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
nxsem_destroy(&priv->wait);
|
||||
fs_heap_free(priv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
nxsem_init(&priv->wait, 0, 0);
|
||||
*handle = priv;
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user