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;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nxsem_init(&priv->wait, 0, 0);
|
||||||
strlcpy(priv->cpuname, cpuname, sizeof(priv->cpuname));
|
strlcpy(priv->cpuname, cpuname, sizeof(priv->cpuname));
|
||||||
ret = rpmsg_register_callback(priv,
|
ret = rpmsg_register_callback(priv,
|
||||||
rpmsgfs_device_created,
|
rpmsgfs_device_created,
|
||||||
@ -752,11 +753,11 @@ int rpmsgfs_client_bind(FAR void **handle, FAR const char *cpuname)
|
|||||||
NULL);
|
NULL);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
nxsem_destroy(&priv->wait);
|
||||||
fs_heap_free(priv);
|
fs_heap_free(priv);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
nxsem_init(&priv->wait, 0, 0);
|
|
||||||
*handle = priv;
|
*handle = priv;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user