Skip to content

Commit

Permalink
rpmsgfs/rpmsgfs_client: init the priv->wait before register rpmsg cal…
Browse files Browse the repository at this point in the history
…lback

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>
  • Loading branch information
CV-Bowen authored and xiaoxiang781216 committed Oct 8, 2024
1 parent 51623d1 commit 4df19fd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/rpmsgfs/rpmsgfs_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down

0 comments on commit 4df19fd

Please sign in to comment.