Call nxmutex_destroy and nxsem_destroy in error patch to avoid the leak
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
a026dbaece
commit
67686c231a
@ -673,6 +673,7 @@ err1:
|
||||
unregister_driver(devpath);
|
||||
|
||||
err0:
|
||||
nxmutex_destroy(&priv->devlock);
|
||||
kmm_free(priv);
|
||||
return ret;
|
||||
}
|
||||
|
@ -3175,6 +3175,9 @@ err1:
|
||||
unregister_driver(devpath);
|
||||
|
||||
err0:
|
||||
nxmutex_destroy(&priv->ioctllock);
|
||||
nxsem_destroy(&priv->apiwait);
|
||||
nxmutex_destroy(&priv->devlock);
|
||||
kmm_free(priv);
|
||||
return ret;
|
||||
}
|
||||
|
@ -514,7 +514,9 @@ struct adc_dev_s *lc823450_adcinitialize(void)
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("adc_register failed: %d\n", ret);
|
||||
kmm_free(g_inst);
|
||||
nxmutex_destroy(&inst->lock);
|
||||
nxsem_destroy(&inst->sem_isr);
|
||||
kmm_free(inst);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -541,12 +543,13 @@ struct adc_dev_s *lc823450_adcinitialize(void)
|
||||
/* Register the ADC driver at "/dev/adc0" */
|
||||
|
||||
ret = adc_register("/dev/adc0", &inst->dev);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("adc_register failed: %d\n", ret);
|
||||
nxmutex_unlock(&inst->lock);
|
||||
kmm_free(g_inst);
|
||||
nxmutex_destroy(&inst->lock);
|
||||
nxsem_destroy(&inst->sem_isr);
|
||||
kmm_free(inst);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1333,6 +1333,7 @@ struct i2s_dev_s *rp2040_i2sbus_initialize(int port)
|
||||
|
||||
errout_with_alloc:
|
||||
nxmutex_destroy(&priv->lock);
|
||||
nxsem_destroy(&priv->bufsem);
|
||||
kmm_free(priv);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -3422,6 +3422,7 @@ errout_with_clocking:
|
||||
|
||||
errout_with_alloc:
|
||||
nxmutex_destroy(&priv->lock);
|
||||
nxsem_destroy(&priv->bufsem);
|
||||
kmm_free(priv);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -3404,6 +3404,7 @@ errout_with_clocking:
|
||||
|
||||
errout_with_alloc:
|
||||
nxmutex_destroy(&priv->lock);
|
||||
nxsem_destroy(&priv->bufsem);
|
||||
kmm_free(priv);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2600,6 +2600,7 @@ struct i2s_dev_s *stm32_i2sbus_initialize(int port)
|
||||
errout_with_alloc:
|
||||
leave_critical_section(flags);
|
||||
nxmutex_destroy(&priv->lock);
|
||||
nxsem_destroy(&priv->bufsem);
|
||||
kmm_free(priv);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1539,6 +1539,7 @@ int stm32_tsc_setup(int minor)
|
||||
|
||||
errout_with_priv:
|
||||
nxmutex_destroy(&priv->devlock);
|
||||
nxsem_destroy(&priv->waitsem);
|
||||
#ifdef CONFIG_TOUCHSCREEN_MULTIPLE
|
||||
kmm_free(priv);
|
||||
#endif
|
||||
|
@ -1399,6 +1399,7 @@ int pic32mx_tsc_setup(int minor)
|
||||
|
||||
errout_with_priv:
|
||||
nxmutex_destroy(&priv->devlock);
|
||||
nxsem_destroy(&priv->waitsem);
|
||||
#ifdef CONFIG_TOUCHSCREEN_MULTIPLE
|
||||
kmm_free(priv);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user