mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
drivers: Destroy mutex and sem in the error path
also correct the order to ensure the memory free is last step Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Masayuki Ishikawa
parent
dee38ce3e8
commit
dca5a3483f
@@ -863,11 +863,7 @@ int mac802154dev_register(MACHANDLE mac, int minor)
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ERROR: Failed to bind the MAC callbacks: %d\n", ret);
|
||||
|
||||
/* Free memory and return the error */
|
||||
|
||||
kmm_free(dev);
|
||||
return ret;
|
||||
goto errout_with_priv;
|
||||
}
|
||||
|
||||
/* Create the character device name */
|
||||
|
||||
@@ -1338,6 +1338,7 @@ int mac802154netdev_register(MACHANDLE mac)
|
||||
return macnet_ifdown(&priv->md_dev.r_dev);
|
||||
|
||||
errout:
|
||||
nxmutex_destroy(&priv->md_lock);
|
||||
|
||||
/* Free memory and return the error */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user