bl602/spi: add reference in bl602_spibus_initialize

and unlock the mutex before return

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-11-09 19:25:49 +08:00 committed by Masayuki Ishikawa
parent 8098c80338
commit e244720aa4

View File

@ -1671,7 +1671,7 @@ struct spi_dev_s *bl602_spibus_initialize(int port)
nxmutex_lock(&priv->lock);
if (priv->refs != 0)
{
priv->refs--;
priv->refs++;
nxmutex_unlock(&priv->lock);
return spi_dev;
@ -1711,6 +1711,8 @@ int bl602_spibus_uninitialize(struct spi_dev_s *dev)
}
bl602_spi_deinit(dev);
nxmutex_unlock(&priv->lock);
return OK;
}