Revert "arch: Don't free the context if the reference doesn't equal zero"
struct stm32_i2c_inst_s instance is allocated on every call to
stm32_i2cbus_initialize, and that instance is supposed to be deleted on every
call to stm32_i2cbus_uninitialize.
The "refs" counter just keeps track on when the last one is deleted, and
everything is unregisterd/disabled.
This reverts commit 8098c80338
.
This commit is contained in:
parent
ee9787a254
commit
f9c8b4015f
@ -2804,6 +2804,7 @@ int stm32_i2cbus_uninitialize(struct i2c_master_s *dev)
|
||||
if (--priv->refs)
|
||||
{
|
||||
nxmutex_unlock(&priv->lock);
|
||||
kmm_free(dev);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -2803,6 +2803,7 @@ int stm32_i2cbus_uninitialize(struct i2c_master_s *dev)
|
||||
if (--priv->refs)
|
||||
{
|
||||
nxmutex_unlock(&priv->lock);
|
||||
kmm_free(dev);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -2842,6 +2842,7 @@ int stm32_i2cbus_uninitialize(struct i2c_master_s *dev)
|
||||
if (--priv->refs)
|
||||
{
|
||||
nxmutex_unlock(&priv->lock);
|
||||
kmm_free(dev);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -2805,6 +2805,7 @@ int stm32_i2cbus_uninitialize(struct i2c_master_s *dev)
|
||||
if (--priv->refs)
|
||||
{
|
||||
nxmutex_unlock(&priv->lock);
|
||||
kmm_free(dev);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -1247,6 +1247,7 @@ int stm32l4_1wireuninitialize(struct onewire_dev_s *dev)
|
||||
if (--priv->refs)
|
||||
{
|
||||
nxmutex_unlock(&priv->lock);
|
||||
kmm_free(priv);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -3007,6 +3007,7 @@ int stm32l4_i2cbus_uninitialize(struct i2c_master_s *dev)
|
||||
if (--priv->refs)
|
||||
{
|
||||
nxmutex_unlock(&priv->lock);
|
||||
kmm_free(dev);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user