rptun: init the semtx before the thread/workqueue created
If the rptun driver set auto start, the smetx may has been used in rptun_notify_wait() but not inited. Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
This commit is contained in:
parent
372fba70bb
commit
41e399aa43
@ -1194,6 +1194,8 @@ int rptun_initialize(FAR struct rptun_dev_s *dev)
|
|||||||
goto err_driver;
|
goto err_driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nxsem_init(&priv->semtx, 0, 0);
|
||||||
|
|
||||||
#ifdef CONFIG_RPTUN_WORKQUEUE
|
#ifdef CONFIG_RPTUN_WORKQUEUE
|
||||||
if (RPTUN_IS_AUTOSTART(dev))
|
if (RPTUN_IS_AUTOSTART(dev))
|
||||||
{
|
{
|
||||||
@ -1221,13 +1223,12 @@ int rptun_initialize(FAR struct rptun_dev_s *dev)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
unregister_driver(name);
|
unregister_driver(name);
|
||||||
|
nxsem_destroy(&priv->semtx);
|
||||||
nxsem_destroy(&priv->semrx);
|
nxsem_destroy(&priv->semrx);
|
||||||
goto err_driver;
|
goto err_driver;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nxsem_init(&priv->semtx, 0, 0);
|
|
||||||
|
|
||||||
/* Add priv to list */
|
/* Add priv to list */
|
||||||
|
|
||||||
nxrmutex_lock(&g_rptun_lockcb);
|
nxrmutex_lock(&g_rptun_lockcb);
|
||||||
|
Loading…
Reference in New Issue
Block a user